Joh*_*rer 11
你可以沿着这些方向做点什么
var requests = [];
setInterval(function() {
if(requests.length > 0) {
var request = requests.pop();
if(typeof request === "function") {
request();
}
}
}, 5000);
// then anywhere you need to make an ajax request
requests.push(function() {
// ajax request here
$.ajax({
url: "/foo", // some variable from outer scope
success: function(a,b,c) {
// handle it
}
});
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7914 次 |
| 最近记录: |