There are many blogs and other posts on using jQuery with MVC. You can find individual posts on:
· How to send objects to an action method via JavaScript.
· How to retrieve partial views.
· How to handle errors.
I have written a sample showing how to do all of these together. The sample is written in MVC 3 using Razor views
The sample demonstrates:
- Cascading dropdown ( see the button Populate from action and Cascading drop down)
- Populating a table from a Partial View(see the button Add New Employee(jquery call action and render)
- How to handle error from action ( press Save 2 )
- How to send id parameters (long) from javascript to action ( press Delete 1 or Delete 2)
- How to send objects(Employee) from javascript to action ( press Save 1 or Save 2)
Without further ado, this is the project . Enjoy!
PS: If you seems that the code is too hard, here is a more detailed explanation :http://msprogrammer.serviciipeweb.ro/2011/12/05/jquery-ajax-request-and-mvcdetailed/




https://mvp.support.microsoft.com/profile/Andrei.Ignat
#1 by Rick Anderson/Microsoft at February 14th, 2011
| Quote
Very cool!
#2 by Aaron at March 3rd, 2011
| Quote
Thanks, I had only seen this done with MVC2
#3 by Fabian at June 21st, 2011
| Quote
Hi! Thanks! It was very helpful for me!
And also i want to know how can i validate a Select created in HTML with the validations in the model?
#4 by Nobel at July 31st, 2011
| Quote
Wow! many thanks man, you’re a genius.
You save a lot of my time research.
#5 by Tri Tram at August 16th, 2011
| Quote
very good article…thanks you so much..your explanation ’s very detail and source code so easy to understand with your break point…once again..good article
#6 by Krokonoster at December 12th, 2011
| Quote
Thanks Andrei.
After being absent from MVC a while, your site was just the place to head to catch up on what I forgot.
Thanks!
#7 by Andrei Ignat at December 12th, 2011
| Quote
Thank you too!
#8 by Frank at January 12th, 2012
| Quote
great article, By learning from your article, I assume that I could make Master Detail Product Entry form in ASP.net MVC.
#9 by Andrei Ignat at January 12th, 2012
| Quote
Exactly. Just look at how I add a new employee and save an existing employee.
#10 by Photobooth Manila at March 16th, 2012
| Quote
Is jQuery can cause a slow loading of a page?
#11 by Andrei Ignat at March 16th, 2012
| Quote
What page? And what does it mean “slow”?