¡@

Home 

2014/10/16 ¤W¤È 12:01:50

jquery Programming Glossary: activeajaxconnections

How to know when all ajax calls are complete

http://stackoverflow.com/questions/287188/how-to-know-when-all-ajax-calls-are-complete

manually detect if any ajax call is still active Create a variable containing number of active Ajax connections var activeAjaxConnections 0 just before opening new Ajax connection increment that variable .ajax beforesend function xhr activeAjaxConnections url.. activeAjaxConnections 0 just before opening new Ajax connection increment that variable .ajax beforesend function xhr activeAjaxConnections url ... in success part check if that variable equals to zero if so the last connection has finished success function html.. ... in success part check if that variable equals to zero if so the last connection has finished success function html activeAjaxConnections '#result_' rowNum .empty .append html '#coda_' rowNum .removeClass loading '#coda_' rowNum .addClass loader if 0 activeAjaxConnections..