2
You’re sending the url as part of the form data. I believe it should be:
$.post(url, {vote:'test'})
Actually, the entire format you’re using is better for $.ajax, so maybe it might just be better to change that post to ajax and add a type: ‘POST’ like
$.ajax({
url: url,
type: 'POST',
// TODO: implement this better.
data: {vote: 'test'},
dataType: 'json',
success: function() {
myElement.toggleClass('arrow-selected');
spinner.addClass('hidden');
myElement.removeClass('hidden');
},
error: function() {
spinner.addClass('hidden');
myElement.removeClass('hidden');
// TODO: make this link to the signup modal.
alert('You must be logged in to vote');
}
});
- [Answered ]-Django Context processors not working?
- [Answered ]-Django: decorator for catching response context from classic views
- [Answered ]-Django updating values to OneToOneField field
- [Answered ]-Filter in custom Django tag?
- [Answered ]-Django related model, create if does not exist?
Source:stackexchange.com