【发布时间】:2015-05-30 20:23:19
【问题描述】:
我正在使用 $.load 从其他本地页面加载内容,但在 chrome 和 firefox 中都出现此错误。
Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience
这是我的代码
$(document).on("click", ".menuL", function() {
var e = $(this).attr("href");
$(".main").html('<center><img src="img/loader.gif" /></center>');
$(".main").load(e + session, function(response, status, xhr){
if(status == "error") {
window.location.href = '/home';
}
});
return false
});
我在谷歌上搜索了所有可能的解决方案,但所有这些都将我引向同一件事,将 async 设置为 true,但我该怎么做呢?
【问题讨论】:
标签: javascript asynchronous xmlhttprequest