Possible Duplicate:
Can't get correct return value from an jQuery Ajax call
This is an extension of my previous question:
Can I check the return code from a function called with Ajax like this below:
rc = submitHandler($link, $modal);
function submitHandler($link, $modal) {
$.ajax({
url: oSubmit.href,
dataType: 'json',
type: 'POST',
data: $form.serializeArray()
})
.done(function (json, textStatus, XMLHttpRequest) {
json = json || {};
if (json.success) {
submitSuccessModal(oSubmit, json);
return true; <---------------------------------------
} else {
submitFailModal(oSubmit, json);
return false; <--------------------------------------
}
return false;
})
}