所以我正在做一个非常基本的ajax请求,但我无法使其在chrome中非阻塞。这个请求有什么问题吗? IE 处理得很好,但 Chrome 完全卡住了几秒钟。 chrome 停止卡住后会触发超时事件。
setTimeout(this.onExtendedSaveTimeCallback, 1000);
this.isSaving = true;
this.request = $.ajax({
url: 'http://same-origin.com',
type: 'POST',
dataType: 'html',
data: data,
async: true,
});
this.request.done(function(response) {
self.isSaving = false;
self.$rootElement.find('.save').removeClass('saving');
if(response != "SUCCESS")
{
// The input did not pass validation
// Show the error message
self.$rootElement.find('.edit-mode-content').prepend(response);
self.$rootElement.find('.error').slideDown(200);
self.$rootElement.find('.save').html('Spara');
self.unblockRowInput();
}
else
self.close(true);
});
最佳答案
我不认为这是ajax调用。我见过类似的情况,当创建 ajax 数据参数非常昂贵时,浏览器会卡住。根据您进行循环/dom 遍历的方式,跨浏览器的性能可能会有很大差异。要进行验证,请尝试提交 ajax 请求,而不执行创建数据参数的工作。
关于jquery - 使用 jQuery 的异步 ajax 请求会卡住 Chrome,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13220200/