Is there any way to know (with some developers tools: chrome, Firefox, Opera, etc) what is last function that fires an AJAX call?
It would be interesting for debugging web apps.
Thank you
You can set the option "async" to false (for the first ajax call). This means that function 2 will be called after function 1 has received a response, i.e. finished it's execution.
What's AJAX? AJAX stands for Asynchronous JavaScript And XML. In a nutshell, it is the use of the XMLHttpRequest object to communicate with servers. It can send and receive information in various formats, including JSON, XML, HTML, and text files.
In Laravel, we can use $request->ajax() method to check request is ajax or not.
Here's how I do it in Google Chrome:
As a result, you'll get a profile similar to the one shown in the picture below. This profile shows every JavaScript call made during the time you were capturing the profile, including any AJAX calls, as well as where in your code the call was made (which function "threw" the call).
As you can see in this other screenshot, I had an AJAX call fired from my script (dash.js, line 51), from a function called doOnSelectDate(), which was itself called from a function called getDailySummary() (defined on line 60).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With