Retrieving POST data from jQuery in Django without a form -


I am currently using the post method for a view of jQuery '{{Csrf_token}}'}, "mysl"

 . "" ("/ Myurl", {'value1': value1, 'value2': value2, 'csrftoken'}, function (data) {warning ("data loaded:" + data);});   

However, I do not know how to get post data without using a form:

  def save_user_graph (requested): If request .method == 'POST': return HttpResponse (request.POST.get ('value1'), condition = 201)   

returns none .

If save_user_graph is not back, request.method is not posted. If the save_user_graph is returning the word 'none' to a HTPRPS, then value1 is not being sent correctly. Can you clarify what is the matter?

If you have Chrome, try navigating to the page with the Developer toolbar. You can go to the 'console' tab and see AJX's request and see that the data was sent correctly.

Similarly, if you have Firefox and Firebug, you can go to the page and view the AJAX request and check the post parameters.

Believing that Javascript works, you want to log the request. In POST save_user_graph . In a pinch, you can only request print. POST And, suppose you are using the Degene Dev server, the output will be printed in the dev server output.

Before we can give a better answer, before that we will need a little more debugging information. :)

Comments