ajax的data传参的两种方式

时间:2023-01-01 19:37:06
1.
/**
* 订单取消
* @return {Boolean} 处理是否成功
*/
function orderCancel(orderId, commant){
var flag = false;
$.ajax({
type: "POST",
url: "../order/orderCancel.action", //orderModifyStatus
data: {"orderId":orderId,"commant":commant},
dataType:"json",
async:false,
cache:false,
success: function(data){
var member = eval("("+data+")"); //包数据解析为json 格式
if(member.success=="true"){
flag = true;
}else if(member.success=="false") {
alert(member.info);
}
},
error: function(json){
alert("订单取消异常,请刷新后重试...");
}
});
hidediv();
return flag;
}

 

2.

data: "orderId=" + orderId + "&commant=" + commant