/**
* 网络请求
* @param {String} type
* @param {Object} url
* @param {Object} data
* @param {Function} successCallback
* @param {Function} errorCallback
*/
var request = function (type, url, data, successCallback, errorCallback) {
// console.log(url);
jQuery.ajax({
url: url,
async: true,
data: JSON.stringify(data),
contentType: 'application/json; charset=utf-8',
dataType: 'json',
type: type,
timeout: 10000,
success: function (result) {
console.log('------网络请求成功-------');
successCallback(result);
},
error: function (xhr, statusText, Thrown) {
// console.log(xhr.status);
// console.log(Thrown);
errorCallback();
}
});
};
版权声明:本文为GoodChangYong原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。