在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
$(function () { $.ajax({ 'url': "/Home/Send2SHengPi", data: JSON.stringify({"WorkId":[1, 2, 3, 4, 5]}), contentType: 'application/json', type: "post", success: function (data) { if (data.suc) { layer.msg('提交成功', { icon: 1 }) t1.draw(true); } else { layer.msg(data.remark, { icon: 2 }) } } }) }) 我们后台怎么对应呢? public class S1 { public int[] WorkId { get; set; } } public ActionResult Send2SHengPi(S1 s1) { return new JsonResult() { Data = new { id = "日前", name = "wre" }, JsonRequestBehavior = JsonRequestBehavior.AllowGet }; } 2、对于复杂点的常规的就是这样。 <script> $(function () { $.ajax({ 'url': "/Home/WorkExes1", data: { "WorkId": JSON.stringify([1, 2, 3, 4, 5])}, //contentType: 'application/json', type: "post", success: function (data) { if (data.suc) { layer.msg('提交成功', { icon: 1 }) t1.draw(true); } else { layer.msg(data.remark, { icon: 2 }) } } }) }) </script> 后台的业务逻辑 public ActionResult WorkExes1(string WorkId) { return new JsonResult() { Data = new { id = "日前", name = "wre" }, JsonRequestBehavior = JsonRequestBehavior.AllowGet }; }
|
请发表评论