Is it possible to return value in loop ?
i call Jsonresult to generate excel file. I create one page per person in my excel file.
For exemple i have 5 people. I want to dislpay
1/5
2/5
…
on my loading div.
foreach (Personnel o in pers19a)
{
count++
//display count/5
}
i use this ajax function:
function CallMe() {
$.ajax({
type: "POST",
url: '@Url.Action("RHS", "Personnels")',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (recData) {
alert('Success');
if (recData.fileName != "") {
//use window.location.href for redirect to download action for download the file
window.location.href = "@Url.RouteUrl(new { Controller = "Personnels", Action = "DownloadRHSSOL"})/?file=" + recData.fileName;
}},
error: function () { alert('A error'); }
});
}
Thanks in advance.