How to Call Controller Actions using JQuery in ASP.NET MVC

后端 未结 5 2070
粉色の甜心
粉色の甜心 2020-11-29 05:28

I\'ve been reading on this for a while and found that you can call a controller action by using:

$.ajax(\"MyController/MyAction\", function(data) {
    alert         


        
5条回答
  •  温柔的废话
    2020-11-29 05:53

    You can easily call any controller's action using jQuery AJAX method like this:

    Note in this example my controller name is Student

    Controller Action

     public ActionResult Test()
     {
         return View();
     }
    

    In Any View of this above controller you can call the Test() action like this:

    
    
    

提交回复
热议问题