jquery-ajax请求
程序员文章站
2022-07-07 22:18:47
...
简化的post和get请求不能设置同步请求,使用ajax请求可以
$.ajax({
type: "POST",
url: "project/findProjectPage.hd",
data: "page=1&rows=20",
async: false,//true:异步,false:同步
dataType:"json",
success: function(data, textStatus, jqXHR) {
console.log(data);
console.log(textStatus);
console.log(jqXHR);
console.log("success-2");
},
error:function (XMLHttpRequest, textStatus, errorThrown) {
console.log(XMLHttpRequest);
console.log(textStatus);
console.log(errorThrown);
}
});
$.ajax({
type: "POST",
url: "project/findProjectPage.hd",
data: "page=1&rows=20",
async: false,//true:异步,false:同步
dataType:"json",
success: function(data, textStatus, jqXHR) {
console.log(data);
console.log(textStatus);
console.log(jqXHR);
console.log("success-2");
},
error:function (XMLHttpRequest, textStatus, errorThrown) {
console.log(XMLHttpRequest);
console.log(textStatus);
console.log(errorThrown);
}
});