I need to process the file uploaded by the user. This process can take a lot of time based on the number of pages in the file. I plan to use the jQuery UIs progress panel and tell the user how many pages have been processed. However, the execution check is not returned until the completion of the first ajax call. Both calls completed correctly by connecting to the appropriate web methods.
I already studied this a bit, and found this answer to another question, which pretty much stated that if both calls use a session, they will not process at the same time. I use a session in only one of the calls.
What am I missing?
This is the initial call that starts file processing. I installed UpdateProgressBar to run the second one after starting the file processing.
setTimeout("UpdateProgressBar();", 1000); $.ajax({ type: "POST", async: true, data: // my params go here url: // path to web method contentType: "application/json; charset=utf-8", dataType: "json", success: function (result) { // Do stuff when file is finished processing }, error: function (XMLHttpRequest, textStatus, errorThrown) { if (errorThrown != null) alert(textStatus + " : " + errorThrown); } });
This is the function of UpdateProgressBar:
function UpdateProgressBar() { $.ajax({ type: "POST", async: true, data: // my params go here url: // path to web method contentType: "application/json; charset=utf-8", dataType: "json", success: function (result) { var totalPages = parseInt($('[id$=lbl_PageCount]').text()); var pagesProcessed = result.d; var percentProcessed = pagesProcessed / totalPages; $('#div_ProgressBar').progressbar("value", percentProcessed); if (pagesProcessed < totalPages) setTimeout("UpdateProgressBar();", 800); }, error: function (XMLHttpRequest, textStatus, errorThrown) { if (errorThrown != null) alert(textStatus + " : " + errorThrown); } });
Edit
This is WebMethod called by UpdateProgressBar. Another WebMethod uses Session, but as you can see, this is not. They both refer to the DLL, however I tried testing without using the DLL to update, and this did not help.
[WebMethod] public static int CheckPDFProcessingProgress(// params go here) { int pagesProcessed = 1; try { OrderService _orderService = new OrderService(); pagesProcessed = _orderService.GetMailingPDFPagesProcessedProgress(PersonID); } catch (Exception ex) {