Using .ajaxComplete() with ajax requests generated by another framework Code Answer

Hello Developer, Hope you guys are doing great. Today at Tutorial Guruji Official website, we are sharing the answer of Using .ajaxComplete() with ajax requests generated by another framework without wasting too much if your time.

The question is published on by Tutorial Guruji team.

I need to execute a few scripts on a page whose ajax requests (onchange/onclick on different elements) are constructed using a custom framework that I cannot change. Fundamentally, I would like to, on successful completion of specific request, execute a few scripts that I have written. Is it possible to use ajaxComplete() or ajaxSuccess() when the ajax call was not initiated using jQuery?

Answer

No. Those are part of the event handling jQuery adds to the events it fires off itself.

I don’t think there’s an event fired when any ajax request at all finishes; your best option is to wrap the XHR constructor before loading this other framework and restore it afterwards. Even that may not work depending on what the framework is actually doing.

Can you be more specific about what this other code is and what you want to add to it? There are events that fire when the page is mutated, for instance, which might be more appropriate.

We are here to answer your question about Using .ajaxComplete() with ajax requests generated by another framework - If you find the proper solution, please don't forgot to share this with your team members.

Related Posts

Tutorial Guruji