When I submit an Ajax request to save a form, I get an empty request.POST
QueryDict. Hopefully I'm just overlooking something due to inexperience with Ajax. Here is the relevant code:
Ajax
<script>
$(function() {
[...]
$(document).ajaxComplete(function() {
[...]
$(".inline-save").click(function() {
$.ajax({
url : '/webApp/saveForm/',
type : 'POST',
dataType : 'HTML',
contentType: 'application/x-www-form-urlencoded;charset=utf-8',
success : function(info) {
$("#info-display").html(info);
}
});
});
});
});
The form I intend to save is brought up with another Ajax call, thus the ajaxComplete
usage. In my urls.py and views.py, I simply redirect to save_view
, which just prints request.POST
for now, which outputs <QueryDict: {}>
- an empty QueryDict.
What am I missing? Even though there are several similar questions, none that I've found have helped me so far.