我想在仪表板上一次执行多个动作。我所做的如下。
我有仪表板,它每15秒刷新一次.ajax调用,第二次ajax调用在完成之前的调用15秒后开始。
我在我的方法中使用async: true。
现在,该页面上还有更多其他ajax调用事件,我的问题是在15秒调用开始的同时单击页面上的任何其他详细报告。它让我等待,并且只在15秒调用结束时加载我的报告。
我不想等待用户,当我的连续调用开始时(15秒),我应该能够加载任何其他报告,并能够调用任何其他ajax方法。
因为,15秒的通话可能需要5-10秒才能得到数据.它让我一直在等待。
下面是我每15秒的代码片段。
//Load Live Data event
function GetLiveData() {
$.ajax({
type: 'POST',
contentType: 'application/json; charset=utf-8',
dataType: 'JSON',
async: true,
cache: false,
data: JSON.stringify({ params }),
url: url,
success: function (result) {
// do soemthing
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
},
complete: function (xhr, status) {
//Auto Refresh Data functionality JS
setTimeOutvar = setTimeout(AutomaticRefreshFunction, RefreshIntervalTime);
//End of Auto Refresh JS
}
});
}请建议,我应该使用MVC 5的异步或任何其他选择吗?
这不是建议的重复。就像我提到的..。
I have one ajax call at every 15 seconds, and that call takes 5-10 seconds to load data, so during that time, If I click on any other button to view data/report - it waits for that regular 15 sec. call. I should not wait and load irrespective to that call.发布于 2015-10-15 09:20:41
实际上,您的问题与ASP.NET并发Ajax请求和会话状态阻塞有关。
因此,异步MVC5在您的场景中并不是更有用的.。
因此,请确保该请求不能通过会话状态的只读或禁用值来更新会话。
https://stackoverflow.com/questions/33143110
复制相似问题