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/
Leave a Reply