//遠端調用 背景的 公用方法
function ajaxAction(action,value){
$.ajax({
type : "post",
url : action,
data :value,//設定資料源
dataType : "json",//設定需要傳回的資料類型
success : function(d) {
if(d.status){
alert("操作成功");
}else{
alert("操作失敗,請稍後再試");
}
}
});
}
Form表單送出資料:
ajaxAction("swebWu.do?m=addAndSend",$('#form1').serialize());
自己組建資料調用(手動拼接資料):
var row = $('#grid'+id).datagrid('getSelections');
if(row.length<1){
alert("請選中需要發送的資料!");
}else{
var list = {};
for (var i = 0; i < row.length; i++) {
list["sendIds[" + i + "]"]= row[i].id;
}
ajaxAction("swebWu.do?m=send",list);