[Django]-Retrieving POST data from jQuery in Django without a form

4👍

If save_user_graph is returning None, then request.method is not POST. If save_user_graph is returning an HttpResponse with the word ‘None’ in it, then value1 isn’t being sent correctly. Can you clarify which is the case?

If you have chrome, try navigating to the page with the developer toolbar open. You can go to the ‘console’ tab and view the AJAX request and see what data was sent with it, to make sure that the data was sent correctly.

Similarly, if you have firefox and firebug, you can go to the page and watch the ajax request and check the post parameters.

Assuming that the javascript works, you’ll want to log request.POST in save_user_graph. In a pinch, you can just print request.POST and, assuming you’re using the django dev server, the output will be printed in the dev server output.

We’ll need a bit more debugging info before we can give a better answer. 🙂

👤So8res

Leave a comment