I'm trying to send a variable (user.id - current user's id) into my JQuery file which calls a view to delete some data in a database. The problem is that I don't know how to pass user.id into the JS file to be able to append it to url request.
In my template:
<script src="{% static "js/checkTestsSittings.js" %}">var userid = {{ user.id | safe }};</script>
JS file:
$(document).ready(function () {
alert(userid); // just a test
request_url = '/check-sittings/'+userid+'/';
$.ajax({
url: request_url
})
});
This is what I see in the console:
I'm beginner in JS and Django. Could you give me a hint?
