标签:
前端用post过来,Controller就要用[HttpPost],前端用get,Controller就要用[HttpGet],或者不管前端用什么,Controller都不加这些。
前端用post
$.ajax({
url: "/CommRecord/LockSendESMS",
type: "post",
data: {
id: data.ID,
isLock: isLock
},
success: function (data) {
}
});
Controller就要用[HttpPost]
[HttpPost]
public ActionResult LockSendESMS()
{
var sendSourceList = this.commRecordService.GetSendSource();
var list = (from n in sendSourceList
select new
{
DetailCode = n.ID,
DetailValue = n.DetailValue
}).ToList();
return Json(new { status = 1, data = list }, JsonRequestBehavior.AllowGet);
}
.net在Controller里的方法添加[HttpGet]和[HttpPost]
标签:
原文地址:http://www.cnblogs.com/zhongzunmu/p/5955766.html