I have a method call Ajax:
function callAjax(url, type, json, callback) {
$.ajax({
type: type,
url: url,
data: json,
async: false,
success: function (data) {
if (callback) {
callback(data);
}
}
});
}
But I don't call back with error in callback.
For example, I can callAjax method like this:
callAjax("http://stackoverflow.com/", "POST", data, function(resp,status){
if(status.success){
//code here
}
if(status.error){
//code here
}
});