Dod*_*odo 4 php ajax jquery multithreading asynchronous
我在一个页面上有2个ajax请求.我跑第一个请求并分别开始第二个请求.但第二个在第一个运行后停止工作.当第一次结束时继续.首先需要花费很长时间 - 例如30-60秒,在这段时间我需要第二个请求来显示第一个请求会发生什么.我尝试使用async:true但它对我没有帮助.
这是我的代码
<script type="text/javascript">
var auto_refresh = setInterval( function()
{ asyncGet('log.php') }, 1000
);
function asyncGet(addr) {
$.ajax({
url: addr,
async: true,
success: function (response) {
$('#loadLog').html(response);
}
});
}
function getConn(addr) {
$.ajax({
url: addr,
async: true,
success: function (response) {
stopGet();
}
});
}
</script>
<div id="loadLog" class="lLog"></div>
Run Code Online (Sandbox Code Playgroud)
我用这种方式首先调用ajax请求:getConn('main.php'); 从功能按下按钮.第二个请求它正在运行,但在第一个请求完成之前没有显示响应.
我会附上来自萤火虫的图片.main.php - 需要更长时间的请求.log.php - 是被阻止的记录器.

真的很感激我指出错误的地方
| 归档时间: |
|
| 查看次数: |
3728 次 |
| 最近记录: |