Home > MVC > How to call controller method from view in MVC using jquery



How to call controller method from view in MVC using jquery

In this article, we will explain how to call controller method from view in MVC using jquery with an example and sample code.


In this article, we will explain how to call controller method from view in MVC using jquery with an example and sample code. In this example, we are using the Jquery button click event. on the click, we using Ajax Post Method to send (pass) array data.

 

Step -1

Open Visual Studio. Click on the file in the menu and select new Project .

How to call controller method from view in mvc using jquery

 

Step -2

Select new project type.

How to call controller method from view in mvc using jquery

 

Index.cshtml

We have provided razor view html below. We are binding the reposne in html table.

 

Models

 

StockController

 

Screenshot

How to call controller method from view in mvc using jquery

 




Note: All contents are copyright of their authors.



Comments



Leave a Reply

Comment:*
Email ID:*


Name:*