I'm trying to display on the client side the current process on the server.
To do this, I defined string in the session-level, and for each process server processor, it updates it, like this:
sessionStatus = "Loading entities from DB";
or
sessionStatus = "Validates the user information";
I am using ajax and Json like this:
The server side:
[OutputCache(NoStore = true, Location = OutPutCscheLocation.None, Duration = 0)]
public JsonResult GetStatus()
{
return Json(new {status = sessionStatus}, JsonRequestBehavior.AllowGet)
}
The client side:
setInterval('displayStatus()', 50);
function displayStatus(){
var url = '@(Url.Action("GetStatus"))';
$.ajax({
url: url,
dataType: "json",
async: false,
success: function(result) {
docunent.getElementById('statusText').innerHTML = result.status;
}
});
}
That's how I expect to see every second, which the server process holds.
But the problem is I only see the first action, then the server performs all his actions,
and in the end I see the last action only for a split second.
I mean he's busy all the processes only on the server, and only then faces the client.
Someone can teach me how in the process the server side can continue the operation even on the client, so that I can see in real time what is happening on the server?
Thank you
refael