Because first the site user allows us to access their location information. And then we use JavaScript code to get his location and send it to Django. The user then fills out another form and sends it to Django. When this form is submitted, we use the information in this form and the location information that was previously submitted for processing.
On Thu, Dec 2, 2021 at 10:09 AM Lalit Suthar <sutharlalit...@gmail.com> wrote: > why can't we make a post request directly > > On Wed, 1 Dec 2021 at 00:24, kayhan <kayhank...@gmail.com> wrote: > >> Hi >> How to first send some data with an Ajax request to Django view and then >> with a post request, send the form information to the same view and use the >> data sent in the previous request (Ajax request) in the second request ? >> >> def planing(request): >> >> if request.is_ajax(): >> # Get user location from user location.js file: >> latitude = request.POST.get('latitude', None) >> longitude = request.POST.get('longitude', None) >> >> >> elif request.method == "GET": >> return render(request, "tourist/planing.html") >> >> >> elif request.method == "POST": >> # Here I want to take the form data and have >> #the previous request data (latitude, longitude) here and do a series of >> processing >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to django-users+unsubscr...@googlegroups.com. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/django-users/317b8fc4-d607-49fc-888b-8030baf0f142n%40googlegroups.com >> <https://groups.google.com/d/msgid/django-users/317b8fc4-d607-49fc-888b-8030baf0f142n%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/CAGp2JVFjNMyr%3DMNgohabEw3J6YVn50GX0pfXCcurTv6HiMWoGA%40mail.gmail.com > <https://groups.google.com/d/msgid/django-users/CAGp2JVFjNMyr%3DMNgohabEw3J6YVn50GX0pfXCcurTv6HiMWoGA%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAO-vjERyaC%3D8Oxd%3DdwX6Q2LB-fWgSQ4vyWUDfFhdZcWO4xuqnA%40mail.gmail.com.