Skip to content Skip to sidebar Skip to footer

Use The Result Of An Ajax Request In My Views.py, Django

Thanks to a javascript function and an ajax request, I have a count indicating the number of points a user makes when he uses my app. He can see that count on the page where he 'pl

Solution 1:

Hm If I understand the question, you need to do the following:

  1. Create your view function, and create a URL pattern in URL.conf that attaches to this view function. Something like /points/save/

  2. This function will likely require the points of the user and the user ID (so you can make changes to the specific user in the database)

  3. You need to make an ajax request that sends the point data and the user ID To the URL that points to your view function. Sent through GET/POST

  4. Your view function will lookup the user from the user id sent from jquery ajax call, then edit the user points with the points sent from the ajax call

Here are a few guides to help

Ajax with Jquery and Django

Django and Jquery

Post a Comment for "Use The Result Of An Ajax Request In My Views.py, Django"