How about wrapper the ajax() call with code like this:
var sendAjax = function (options) {
var type = 'GET';
var dataType = 'json';
var success = options.onsuccess || function () {};
var error = options.onerror || function () {};
var url = options.url;
var data = options.data;
$.ajax({
type: type,
url: url,
data: data,
dataType: dataType ,
success: success ,
error: error
});
};
Then replace your ajax call to sendAjax();