The Form still submits in IE even though there is preventdefault
and returnvalue = false
.
Everything is fine in Chrome and firefox.
I have also tried event.stopPropagation()
.
$('#form1').submit(function(event) {
var xxx = $('#xxx').val();
var yyy = $('#yyy').val();
var zzz = $('#zzz').val();
var uuu = $('#uuu').val();
if (zzz != '000000' && zzz != '') {
validate_xxxyyy(uuu, function(response) {
if (response === false) {
if (xxx == '') {
alert("XXX undefined!");
event.preventDefault ? event.preventDefault() : event.returnValue = false;
}
else if (yyy == '') {
alert("yyy Undefined!");
event.preventDefault ? event.preventDefault() : event.returnValue = false;
}
}
else {
return true;
}
});
}
else {
return true;
}
});
function validate_xxxyyy(uuu, callback) {
var data_string = 'uuu=' + uuu;
$.ajax({
url: 'ajax.php',
type:'POST',
data: data_string,
dataType: 'json',
cache: false,
async: false,
success: function(response){
callback(response);
}
});
}