I have two ajax calls. Both are sync. Both call methods from one controller. But the second method gets hit first. Why is this and how to change it?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
As name said Ajax – Asynchronous JavaScript
Ajax is async
Edit
For you question you can do like calling second URL on response of first one, A simple jQuery example is,
Moreover jQuery supports async flag that can be set to false to activate Asynchronous nature of the query. But this will block all other request from same page.
Please read more on this here