var config = "https://*******.com";
var aHttp = {};
aHttp.resultHandler = function(opt) {
var option = {
url: config + opt.url,
type: 'post',
dataType: 'json',
data: opt.data,
contentType: 'application/json;charset=UTF-8',
success: opt.success
};
option.error = function() {
};
$.extend(option, opt);
return $.ajax({
type: option.type, // 请求方式
dataType: option.dateType,
url: config + option.url,
data: option.data,
timeout: 60000,
contentType: 'application/json;charset=UTF-8',
success: option.success,
// 获取错误信息
error: option.error
});
};
aHttp.aPost = function( url, data, back) {
return aHttp.resultHandler({ url: url, data: data?data:{}, success: back?back:null });
};