【发布时间】:2013-10-03 11:45:35
【问题描述】:
此代码(我的意思是 ajaxStart/ajaxStop)仅适用于 Google Chrome。
$.ajax({ type: "GET",
url: '<?=base_url();?>' + url,
async: false,
success : function(html)
{
modal = html;
}
});
$(document).ready(function() {
$(document)
.ajaxStart(function () {
$('#spinner').show();
})
.ajaxStop(function () {
$('#spinner').hide();
});
});
如何在 chrome 中使用 ajaxStart/ajaxStop?
更新:我没有错误。谷歌浏览器只是忽略 ajaxStart/ajaxStop 动作。 html 和 body 而不是 document 也不起作用。
在后端我使用睡眠 5 秒来查看加载过程。
是的,我使用的是最新版本的谷歌浏览器。
@Murali,这很神奇。浏览器忽略 show()。但是,如果我在 alert() 之后/之前写,一切都好。怎么样?
【问题讨论】:
-
我不确定,但不要使用 $(document).ajaxStart.... 尝试使用 $('html,body').ajaxStart... 。也许它可以工作。
-
您最近是否偶然更新到 Chrome 30?
标签: jquery ajax google-chrome