Ok, so I have a sort of obscure question. I know what the problem is and the solution, but I don't understand why.
There is one method that steps through some prep work, validation, saving and cleaning up. We have this logic in a few different instances. I was hoping to get some insight as to why the first method works but the second method displays a broken image for the "doneMessage" Is there a reference that's lost or something like that???
I imagine I'll get the questions about why the UI is being blocked right before the page is refreshed. Before this method is called the UI is blocked with a please wait message which works perfectly. This is just a visual confirmation to the user that the save did happen before refreshing the page.
The code for the AjaxCall is just a simple JSON AJAX call. I can post the code if needed but I don't think it's really relevant to the question.
This works with the $.blockUI call in the success handler of the AJAX call
function Step(stepNumber) {
switch (stepNumber) {
case 1:
ajaxParameters = "blah:'" + blah + "', yada:" + yada;
setTimeout(function () { Step(2) }, 50);
break;
case 2:
AjaxCall("FormStyle.aspx", "Validate", ajaxParameters, function () {
setTimeout(function () { Step(3) }, 50);
});
break;
case 3:
AjaxCall("FormStyle.aspx", "Save", ajaxParameters, function () {
$.blockUI({ message: doneMessage, css: { padding: 5} });
setTimeout(function () { RefreshCurrentPage() }, 50);
});
break;
}
}
This however, does not. It displays a broken image:
function Step(stepNumber) {
switch (stepNumber) {
case 1:
ajaxParameters = "blah:'" + blah + "', yada:" + yada;
setTimeout(function () { Step(2) }, 50);
break;
case 2:
AjaxCall("FormStyle.aspx", "Validate", ajaxParameters, function () {
setTimeout(function () { Step(3) }, 50);
});
break;
case 3:
AjaxCall("FormStyle.aspx", "Save", ajaxParameters, function () {
setTimeout(function () { Step(4) }, 50);
});
break;
case 4:
$.blockUI({ message: doneMessage, css: { padding: 5} });
RefreshCurrentPage()
break;
}
}