测开之路四十三:ajax请求
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请求同理
讨论群:249728408