When we make this ajax call, intermittently I get HTTP status code as 302. While most of the times, the ajax call is successful as well returning HTTP status as 200 OK. I am unable to get the exact reason for this and how to overcome this scenario. The HTTP status 302 is returned in particular scenario when I leave the application idle for 10-15 minutes and then make this call. However when I hit the URL directly in browser the correct data is returned. Please advice.
function checkProgressStatus(event){
$.ajax({
url: "/"+window.AppContext+"/servlet/Progress",
cache: false,
dataType: 'json',
async:false,
success: function(data,ev){
if(data.Progress == 'INPROGRESS'){
alert("Execution in progress");
event.stopImmediatePropagation();
}
},
error: function (exception) {
alert("Request to check inprogress status failed.");
window.open("/"+window.AppContext+"/path/filter/AnotherPage.html");
}
});
}