我正在寻找一个DOJO函数,它在代码完成时运行更改,类似于下面的函数:
$(document).ajaxComplete(function() {
// run changes here
});
我试过了:
dojo.addOnLoad(function(){
// run changes here
});
但是,当有DOJO AJAX调用时,我仍然会丢失我的更改。我不打算只是为了听完一个AJAX来打电话。
答案 0 :(得分:3)
Dojo中ajaxComplete的替代方案是侦听dojo / request / notify模块的“done”事件
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
}
});
有关详细信息,请参阅http://dojotoolkit.org/reference-guide/1.9/dojo/request/notify.html。