Monday, July 13, 2015

ASP.NET MVC Call Controller with jQuery $.ajax and Return PartialViewResult


Didn't find a one-stop answer to this question, so here it is:

"How do I POST JSON to an ASP.NET MVC controller?"

It's actually quite simple. Follow the following steps.

1. Create a model to represent the data structure you want to POST

2. Create a controller method to represent the endpoint you want to contact

3. Create the following jQuery call to make an AJAX call from the frontend to the backend

You can return a PartialViewResult from the controller, and as long as the jQuery AJAX call expects html it will be done.

Hope this helps someone.


  1. This comment has been removed by the author.

  2. You explained it so perfectly. I was worried to learn this because I stay busy with affordable essay and I thought it would take a lot of time. But I learned it quickly through your post.

  3. You have a lot of knowledge in resolving this issue. You provide interesting information and explanations of how you did it. The attention you pay to blogging makes it popular.