Reputation: 73
I am looking for a DOJO function that runs changes when code is complete similar to this function below:
$(document).ajaxComplete(function() {
// run changes here
});
I have tried:
dojo.addOnLoad(function(){
// run changes here
});
However, I am losing my changes still when there is a DOJO AJAX call. I am not trying to make an AJAX call just to listen for a completed one.
Upvotes: 1
Views: 473
Reputation: 61
Alternative to ajaxComplete in Dojo is listening to "done" event of dojo/request/notify module
notify("done", function(responseOrError){
// Do something whether a request has succeeded or failed
if(responseOrError instanceof Error){
// Do something when a request has failed
}else{
// Do something when a request has succeeded
}
});
See http://dojotoolkit.org/reference-guide/1.9/dojo/request/notify.html for more details.
Upvotes: 3