Php 如何在弹出窗口中频繁显示ajax响应
如果您只想将结果写入弹出窗口,可以使用:Php 如何在弹出窗口中频繁显示ajax响应,php,ajax,Php,Ajax,如果您只想将结果写入弹出窗口,可以使用: $.ajax({ type : "POST", url:"<?php echo TESTMINE_APP_URL; ?>/ajax/export-details", data:'paginationHash='+paginationHash+'&exportType='+exportType+'&userId='+userId,
$.ajax({
type : "POST",
url:"<?php echo TESTMINE_APP_URL; ?>/ajax/export-details",
data:'paginationHash='+paginationHash+'&exportType='+exportType+'&userId='+userId,
dataType: "html",
success: function(requestId)
{
setInterval(function () {
var status = checkStatusOfRequest(requestId);
//here status has to show in pop up window
}, 9000);
}
});
您想每9秒调用一次ajax吗?是的,我每9秒调用一次ajax,其响应消息应显示在弹出窗口中。否,您在同一个1请求上每9秒调用一次ajax并调用checkStatusOfRequest。回答是的。。每9秒钟我调用一次checkStatusOfRequest函数。在使用ajax的函数中,它会获取数据的状态,并返回到controlFirst ajax调用以插入详细信息。之后,我将每隔一个频繁的时间间隔使用该请求Id来获取requestId,我调用checkStatusOfRequest函数以检查状态,该状态应显示在pop upThanks..在该opend窗口中,它必须更新状态。如果状态为“就绪”,则启用该窗口中的按钮。成功:functionrequestId{var popup=window.opensample1.php,500500;popup.document.write'status:';setIntervalfunction{var status=checkStatusOfRequestrequestId;popup.document.getElementById'status'。innerHTML=status;},9000}
success: function(requestId){
var popup = window.open("");
popup.document.write('<html><body>Status: <span id="status"></span></body></html>');
setInterval(function(){
var status = checkStatusOfRequest(requestId);
popup.document.getElementById('status').innerHTML = status;
}, 9000)
}