错误::
jquery.min.js:2 POST http://127.0.0.1:9000/xyz/test 0()
path('test', views.test,name="test")
def test(request):
json_data= json.dumps({"query_id":"213"})
return HttpResponse(json_data, content_type='application/json')
function call_ajax(){
$.post({
url: "{%url 'home:test'%}",
data: {
'csrfmiddlewaretoken': '{{ csrf_token }}'
},
success: function (data) {
console.log(data.query_id);
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
alert(XMLHttpRequest.responseText);
}
});
}