I'm using ajax to do some validation on some dates passed (basically making sure that the first date/time occurs before the 2nd date/time, and neither are blank).
If I have async set to true, it works, but I get a false positive because it's working at the same time as the rest of my form validation. If I set it to false, then I get an error along the lines of "XMLHttpRequest Exception 101".
I'm just wanting to know what causes this error and how does one get rid of it (while keeping async set to false). I do have other options to get around it, but I'd rather know what it is and how to fix it.
example querystring ?action=validate_dates&start_date=12/12/2009 21:00:00&end_date=12/12/2009 23:00:00&rsvp_start=11/21/2009&rsvp_end=11/30/2009
Will return either "" or a comma seperated list of fields that should be marked bad.
function validate_event()
{
$.ajax({
type: "POST",
url: "company_event_ajax.php",
data: querystring,
dataType: "text",
async: false,
error:function (xhr, ajaxOptions, thrownError)
{
alert(thrownError);
},
success: function(msg)
{
if (msg == "")
{
$("#event_start_date,#event_end_date,#rsvp_start_date,#rsvp_end_date").css("background-color", "#fff");
}
else
{
var errs = msg.split(',');
for (i = 0; i < errs.length; i++)
{
$("#"+errs[i]).css("background-color", "#fcc");
}
disable = true;
}
}
});
if (disable) return false;
else return true;
}
This is not the first time this is happening. I'd like to know exactly what causes the 101 error to come about and how to avoid it/fix it.