Make an AJAX request using $.ajax in MVC 4

前端之家收集整理的这篇文章主要介绍了Make an AJAX request using $.ajax in MVC 4前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

http://stackoverflow.com/questions/13019778/make-an-ajax-request-using-ajax-in-mvc-4

HomeController.cs

 public string test(){ return "It works"; }

View.cshtml

}

function inventory(dealerID) { $.ajax({ url: '@Url.Action("test","Home")', data: {dealerID: dealerID}, type: 'POST', success: function(data) { alert(data); } });
[HttpPost] public ActionResult test(string dealerID) { return Content("It works"); }

猜你在找的Ajax相关文章