Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

108
Views
In foreach JSonResult return value ajax

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.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!