How can I detect 'any' ajax request being completed using jQuery? -


i have page can insert javascript / jquery manipulate output. don't have other control on page markup etc.

i need add element via jquery after each present on page. issue elements generated via asynchronous call on existing page occurs after $(document).ready complete.

essentially, need way of calling jquery after page has loaded , subsequent ajax calls have completed. there way detect completion of ajax call on page , call own custom function insert additional elements after newly created s ?

unfortunately doesn't apply since seems op isn't using $.ajax() or jquery ajax method loading content, leaving here in case future googler's doing this.


you can use any of global ajax events meet needs here, you're after $.ajaxcomplete() or $.ajaxsuccess().

for example:

$(document).ajaxsuccess(function() {   alert("an individual ajax call has completed successfully"); }); //or... $(document).ajaxcomplete(function() {   alert("all current ajax calls have completed"); }); 

if want run generic function attach them document (they're events underneath). if want show in particular, example modal or message, can use them bit neater (though doesn't seem you're after), this:

$("#mymodal").ajaxcomplete(function() {   $(this).fadein().delay(1000).fadeout(); }); 

Comments

Popular posts from this blog

php - Permission denied. Laravel linux server -

google bigquery - Delta between query execution time and Java query call to finish -

python - Pandas two dataframes multiplication? -