jquery 之ajax,get,post異步請求簡單代碼模版
$.get( "../cart/cart_list.do",
"productId="+productId,
function(data){
alert(data);
}
);
post
$.post( "../cart/cart_list.do",
"productId="+productId,
function(data){
alert(data);
}
);
Post與get的格式是一樣的
Ajax
url=__ctx+"/maintenance/onceequipment/tdJxdEquipment/dialogGltxfsdSend.ht";
var params ={
"ids":arrIds,
"id":id
};
$.ajax({
"url":url,
"type":"post",
"async":true,
"data":params,
"dataType":"json",
"success":function(data){
if(data==‘true‘){
$.ligerDialog.success("操作成功","提示信息", function(rtn) {
if(rtn){
//刷新父類窗口
try{
getParentWindow().refreshLeftTree();
}catch(e){}
self.location=document.referrer;
}
});
}else{
$.ligerDialog.err("提示信息","失敗!","操作失敗");
//刷新父類窗口
try{
getParentWindow().refreshLeftTree();
}catch(e){}
self.location=document.referrer;
}
}
});
jquery 之ajax,get,post異步請求簡單代碼模版