I have the following code that I run on each page:
$(document).ready(function () {
$(document).ajaxStart($.blockUI);
$(document).ajaxStop($.unblockUI);
$("form").submit(function() {
if ($(this).valid() == true) {
$.blockUI();
}
});
});
This code allows me to present a “loading ...” message during AJAX calls and form messages. In general, this works fine. However, I have a scenario in which I need to make an AJAX call to validate a piece of data before creating a form message as follows:
$.ajax({
url: '/Item/VerifyFolder/',
type: 'POST',
dataType: 'json',
data: {
folderName: folderName
},
success: function (data, textStatus, jqXHR) {
$.unblockUI();
if (data.folderItemExists == true)
{
$("form").submit();
}
else
{
if (confirm("The folder specified for this item does not exist. Do you want to create it?") == true)
{
$("form").submit();
}
else
{
return false;
}
}
},
error: function (jqXHR, textStatus, errorThrown) {
DisplayError(textStatus);
}
});
In my AJAX callback, I start with the call $.unblockUI(). However, this does not seem to have any effect. As a result, the message “Loading ...” is still displayed when a warning appears.
I have seen various posts on the Internet about problems with IE 8 and the unblockUI method (garbled HTML, requiring a meta tag, etc.), but I have yet to find a solution that works.
. !