The queue works fine. Using the queue for the $ .ajax methods that need to be called sequentially works fine. If I used the parameter "async: false" without using a queue, the user interface is updated only after the completion of all long processes.
Thanks for pointing me in the right direction! Here is my last code if someone is looking for:
function callService(url, workflowid, modelid, next) { var jData = {}; jData.workflowid = workflowid; jData.modelid = modelid; //alert(JSON.stringify(jData)); $.ajax({ url: url, type: "POST", dataType: "json", contentType: "application/json; charset=utf-8;", async: true, cache: false, data: JSON.stringify(jData), success: function (oResult) { $("#Message").append(" " + oResult.Message); if (!oResult.Success) { $("#<%:this.FailureText.ClientID %>").append(" " + oResult.Error); } else { next(); } }, error: function (exc) { $("#Message").append(" " + exc.responseText); } }); } function runServices() { var queueElement = $("#q"); var queueStatus = $("#Message"); queueStatus.append("<br/>Starting workflows at : " + new Date() + "<br/>"); var list = $(":input:checkbox:checked"); // getting all selected checkboxes. $(list.each(function () { var workflowid = $(this).val(); queueElement.queue("WorkflowQ", function (next) { callService("/Services/Workflow.svc/rest/runworkflow", workflowid, document.getElementById('<%=this.MODELID.ClientID%>').value, next); }); })); queueElement.dequeue("WorkflowQ"); }; <input type="button" id="ExecuteButton" value="Execute Workflow" class="button" onclick="runServices();"/> <div id="Message"></div> <div id="q"></div>
akash source share