Dear all,
Because IE behaves differently to FF I have to implement a ‘mother
function’ that only returns a value after an ajax call finished.
Basically this works fine in FF:
HTML:
<p id="error_message_step1" style="color:red;"></p>
Script:
$(document).ajaxStart(function() { $.blockUI({ message: 'hello',
overlayCSS: { backgroundColor: 'green'} }); })
$(document).ajaxStop(function() { $.unblockUI(); })
function step1_validator() {
...
$.ajax({
url: "../bla",
type: "POST",
dataType: "text",
data: { userName: userName, email: email, password:
password, confirmPassword: confirmPassword },
async: false,
error: function(XMLHttpRequest, textStatus,
errorThrown) {
$('#error_message_step1').text("Server error " +
textStatus + " " + errorThrown);
},
success: function(data) {
var x = JSON.parse(data);
$('#error_message_step1').html(x.message);
}
});
if (!$('#error_message_step1').text() ) {
return true;
}
else {
return false;
}
}
It blocks the screen whilst the Ajax call is executed. Unfortunately,
this does not work for IE. The screen is only briefly blocked. Why is
this and what is a possible work around?
BTW, if I use an asynchronous ajax call the step1_validator ‘mother
function’ returns without waiting for the ajax call which I have to
avoid.
Looking forward to hearing from you. Thanks in advance.
Best wishes,
Christian