Javascript 如何将原型“Ajax.Responders.register”转换为jQuery
我必须将一些原型代码翻译成jquery,但我不知道如何翻译这部分:Javascript 如何将原型“Ajax.Responders.register”转换为jQuery,javascript,jquery,ajax,prototypejs,Javascript,Jquery,Ajax,Prototypejs,我必须将一些原型代码翻译成jquery,但我不知道如何翻译这部分: Ajax.Responders.register({ onCreate: function() { $('working').show(); window.onbeforeunload = check_working; }, onComplete: function() { $('working').hide(); window.onbeforeunload = null; } }
Ajax.Responders.register({
onCreate: function() {
$('working').show();
window.onbeforeunload = check_working;
},
onComplete: function() {
$('working').hide();
window.onbeforeunload = null;
}
});
事实上,我找到了一些处理此问题的页面,例如,但我这样做了:
jQuery(document).ajaxSend(function() {
jQuery('#working').show();
window.onbeforeunload = check_working;
});
jQuery(document).ajaxStop(function() {
jQuery('#working').hide();
window.onbeforeunload = null;
});
我也不知道为什么,但我从来没有进入过ajax.start和stop,我用console.log尝试过,做的事情和我在上一个版本中做的一样。我没有错
你有什么办法修理它吗
提前感谢。从:从jQuery 1.8开始,.ajaxSend方法应仅附加到文档抱歉,我的帖子不正确,我使用了jQuerydocument.ajax。。。