JavaScript Ajax封装
function ajaxNotJsonParamPOST(way , url , params , success){
$.ajax({
type: "POST",
url: url,
async: way ,
data : params ,
beforeSend: function(request) {
},
success: function(msg){
success(msg);
}
});
}
function ajaxParamPOST(way , url , params , success){
$.ajax({
type: "POST",
url: url,
async: way ,
dateType: "json",
data : params ,
beforeSend: function(request) {
},
success: function(msg){
success(msg);
}
});
}
function ajaxParamPOSTBody(way , url , params , success){
$.ajax({
type: "POST",
url: url,
async: way ,
dataType:"json",
contentType:"application/json",
data:JSON.stringify(params),
beforeSend: function(request) {
},
success: function(msg){
success(msg);
}
});
}
function ajaxParamTypePOST(way , url ,contentType , data , success){
$.ajax({
type: "POST",
url: url,
async: way ,
contentType: contentType,
dateType: "json",
data : data ,
success: function(msg){
success(msg);
}
});
}
function ajaxParamGET(way , url , params , success){
$.ajax({
type: "GET",
url: url,
async: way ,
dateType: "json",
data : params ,
beforeSend: function(request) {
},
success: function(msg){
success($.parseJSON(msg));
}
});
}
function ajaxNotParamGET(way , url , success){
$.ajax({
type: "GET",
url: url,
async: way ,
dateType: "json",
beforeSend: function(request) {
},
success: function(msg){
success($.parseJSON(msg));
}
});
}
function ajaxNotParamPOST(way , url , success){
$.ajax({
type: "POST",
url: url,
async: way ,
dateType: "json",
beforeSend: function(request) {
},
success: function(msg){
success(msg);
}
});
}