Sorry I did not ask the question well. Question: 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. On Tue, Nov 30, 2021 at 1:53 AM David Nugent <dav...@uniquode.io> wrote: > A little more context would help, "use it in another application" is a > little vague. The backend the API request and can pretty much do anything > you need in the corresponding view at that point but should endeavour to > return an appropriate response ASAP. > > On Tue, Nov 30, 2021 at 12:35 AM kayhan <kayhank...@gmail.com> wrote: > >> How to get a variable from an ajax request and use it in another >> application in Django? >> >> -- >> 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/a0d16b47-bb60-46e3-bb5a-53ec718cf172n%40googlegroups.com >> <https://groups.google.com/d/msgid/django-users/a0d16b47-bb60-46e3-bb5a-53ec718cf172n%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/CAE5VhgW-A1K8H%2BpOd499c59tnGMwUSRv%3DVxEOsSNf1XGtzRAmA%40mail.gmail.com > <https://groups.google.com/d/msgid/django-users/CAE5VhgW-A1K8H%2BpOd499c59tnGMwUSRv%3DVxEOsSNf1XGtzRAmA%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-vjETw66Q8AEMupba7AQr5o%3D1j%2B5VWF4wV_EWQv%3DV5ZRwBKg%40mail.gmail.com.