Request.session in django doesnt pass through ajax unless i refresh the page
request.session remains the old one unless i hit refresh to the page
any help would appreciated
` $(document).ready(function () {
$("#specialty_form").on('change', function (event) {
event.preventDefault();
function getCSRFToken() {
return $('meta[name="csrf-token"]').attr('content');
}
$.ajaxSetup({
headers: {
'X-CSRFToken': getCSRFToken()
}
});
$.ajax({
type: 'POST',
url: '/specialty',
data: {
specialty: $("#specialty").val(),
csrfmiddlewaretoke: $('input[name="csrfmiddlewaretoken"]').val(),
},
})
})
});`
New contributor
Khaled Deek is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.