Created
March 24, 2014 15:18
-
-
Save kiran-machhewar/9742224 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function addXMLRequestCallback() { | |
var oldSend, oldonreadystatechange; | |
/*saving the orginal method*/ | |
oldSend = XMLHttpRequest.prototype.send; | |
/*overrideing the default behaviour*/ | |
XMLHttpRequest.prototype.send = function() { | |
/*calling the default behaviour*/ | |
oldSend.apply(this, arguments); | |
oldonreadystatechange = this.onreadystatechange; | |
this.onreadystatechange = function ( progress ) { | |
oldonreadystatechange(progress); | |
onFinshAjaxRequest(); | |
}; | |
} | |
} | |
function onFinshAjaxRequest(){ | |
//code which needs to be executed once the the ajax request is completed. | |
/*************************************/ | |
/******HERE GOES YOUR JS CODE*********/ | |
/*************************************/ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment