后台:
public JsonResult Change(string old, string new)
{
bool success = false;
string content = string.Empty;
// ……数据操作
return Json(new
{
success = success,
content = content
}, JsonRequestBehavior.AllowGet);
}
function updateOrder(old,new) {
$.ajax({
url: "@(Interface.Common.Config.HostUrl)/……Controller/Change",
dataType: "json",
data: {
old: old,
new: new
},
success: function (data) {
if (data.success) {
//成功,……
} else {
//失败,……;
}
}
});
}