|
sendRequest : function(options) {
var self = this;
return $.ajax({
"type" : "post",
"async" : options.async ? options.async : false,
"dataType" : "json",
"timeout" : options.timeout ? options.timeout : 0,
"contentType" : "application/json",
"url" : getUrl(options.baseUrl||this.BASE_URL,options.url,options.action),
"data" : JSON.stringify(options.params),
"complete" : function(xhr) {
if (xhr.readyState == 4 && xhr.status == 200) {
if (options.success) {
options.success.call(this, xhr.responseJSON, xhr);
}
} else {
var msg = self.getErrorMsg(xhr);
if (options.error) {
options.error.call(this, msg, xhr);
} else {
self.showError(msg);
}
}
}
});
}, |
|