ajax固定套路
function http(url, data, method, success, fail) {
data = method == 'GET' ? data : JSON.stringify(data)
console.log(data);
$.ajax({
url: url,
type: method,
dataType: 'json',
contentType: 'application/json; charset=UTF-8',
data: data,
success: success,
error: fail
});
}
get请求
post请求同理