C#控制器方法:
[HttpPost] public ActionResult MyAction(string param1, int param2) { // do something with the parameters return Json(new { success = true }); }
AJAX请求:
$.ajax({ url: "/MyController/MyAction", type: "POST", data: JSON.stringify({ param1: "value1", param2: 123 }), contentType: "application/json", dataType: "json", success: function(result) { // handle the response }, error: function(error) { // handle the error } });