This is what I use for your attempts:
You also have access to the XHR object if you need to access it.
//Global Ajax Complete $("body").bind("ajaxSend", function(e, xhr, settings){ //Sent }).bind("ajaxComplete", function(e, xhr, settings){ //Complete }).bind("ajaxError", function(e, xhr, settings, thrownError){ //Error });
EDIT: This is my structure that works for me.
site.js
function afterLoad() { // code to execute } $(document).ready(function(){ $("body").bind("ajaxComplete", function(e, xhr, settings){ afterLoad(); }); });
Created fast fiddle . Is that what you mean?
Change two:
You might need a DOM listener for any <form> element that appears, and then run your afterLoad() function. It may be a pig, so I will use it carefully.
I use livequery to do this
$('form').livequery(function(){ afterLoad(); });
Amin eshaq
source share