我有jquery.ajax总是向服务器请求数据。我的问题是当我点击某个导航菜单时我无法导航它太慢了。我试图评论成功内的方法,它工作正常,我可以很快导航,因为没有请求运行...任何想法如何使这项工作有请求同时运行,我可以导航到其他页面。?。运行jquery.ajax导致在导航到其他页面时速度减慢
更多的输入信息非常感谢。
预先感谢您。
$(function(){
getUpdates();
});
function getUpdates(){
type: "GET",
dataType:'json',
url: "updates.php",
error: function() {
setTimeout(getUpdates, 5000);
},
success: function(data){
//do something with the data
...
...
...
getUpdates(); //call again the function
}
});
}
尝试使用'setTimeout(getUpdates,5000);''inside'success:',而不是'getUpdates();' – ariel 2014-09-21 14:46:04