一个简单的Ajax实例
程序员文章站
2022-07-12 19:30:24
...
οnclick="btn_transfer_CT()"
<input id="btn_ITsubmit" οnclick="btn_transfer_CT()" style="margin-left: 20px;"
type="button" class="btn btn-primary" value="批量转移" />
JS:
//批量邮催ct
function btn_transfer_CT() {
debugger;
var TransferByPerson = document.getElementById("txt_user").value;
var ids = $('#gridList_claim').jqGrid('getGridParam', 'selarrrow');
var str = ids.join(','); debugger;
$.ajax({
type: "post",
url: CreateFullUrl("/CBSTransfer/TransferData"),
data: {
"list": str,
TransferByPerson: TransferByPerson
},
success: function (date) {
href = "javascript:void(0);";
if (date["scruce"]) {
$.modalAlert("批量转移成功", "complete");
} else {
$.modalAlert("批量转移失败", "warning");
}
}
});
}
批量转移
public ActionResult TransferData()
{
FlowService.FlowServiceSoapClient client = new FlowService.FlowServiceSoapClient();
var user = ServiceContext.GetUserInfo();
bool f = false;
string TransferByPerson = Request["TransferByPerson"];
var strId = Request["list"];
if (string.IsNullOrWhiteSpace(strId)||string.IsNullOrWhiteSpace(TransferByPerson)) return Json(new { scruce = f });
string[] arr = strId.Split(',');
foreach (var item in arr)
{
var csc = DBAction<SMS_TRANSFER_CBS>.LoadEntities(c => c.T_ID == item).FirstOrDefault();
var stepsId = client.GetAllSteps(user.LoginName, Convert.ToInt32(csc.TASKID));
//client.GetInProcessSteps(user.LoginName, Convert.ToInt32(csc.TASKID))
var list= JsonConvert.DeserializeObject<WordFlowModel>(stepsId);
int sc = list.children.Count-1;
var ss= list.children[sc].StepID;
var Positions = YZ_API_Utility.GetUserPositions(TransferByPerson);
f = YZ_API_Utility.Transfer(user.LoginName,Convert.ToInt32(ss) , Positions, "无");
}
return Json(new { scruce = f });
}
上一篇: jqery监控页面数据是否发生变化
下一篇: webpack--概念2--入口起点