This JSON request:
$.ajax({
url:jSONurl+\'?orderID=\'+thisOrderID+\'&variationID=\'+thisVariationID+\'&quantity=\'+thisQuantity+\'&callback=?
Check out the jqXHR Object docs. You could use the fail method to capture any errors.
Something like the following for your case:
$.post(jSONurl+'?orderID='+thisOrderID+'&variationID='+thisVariationID+'&quantity='+thisQuantity+'&callback=?')
.done(function(data){
if (data.response == 'success'){
//show the tick. allow the booking to go through
$('#loadingSML'+thisVariationID).hide();
$('#tick'+thisVariationID).show();
}else{
//show the cross. Do not allow the booking to be made
$('#loadingSML'+thisVariationID).hide();
$('#cross'+thisVariationID).hide();
$('#unableToReserveError').slideDown();
//disable the form
$('#OrderForm_OrderForm input').attr('disabled','disabled');
}
}, "json")
.fail(function(jqXHR, textStatus, errorThrown){
alert("Got some error: " + errorThrown);
});
I would also look into passing a json data string via post instead of attaching query variables:
$.post(jSONurl, $.toJSON({orderID: thisOrderID, variationID: thisVariationID, quantity: thisQuantity, callback: false}))