1.POST
//POST方式
$(function () {
//请求参数
var list = {};
$.ajax({
type: "POST",
accepts: "application/json",
contentType: "application/json",
url: "",
data: JSON.stringify(list),
success: function (result) {
//。。。
},
error: function (e) {
console.log(e.status);
console.log(e.responseText);
}
});
});
2.GET方式
//GET方式
$(function () {
//请求参数
var list = {};
$.ajax({
type: "GET",
//自动添加时间戳,避免缓存。
cache: false,
url: "",
success: function (data) {
$.each(data, function (key, item) {
//数据处理
});
}
});
});
3.PUT方式