Tuesday, 20 August 2013

MVC 4 - update partial views

MVC 4 - update partial views

I have 2 sections on a page. Let's call the page index.cshtml.
The first section is the "search criteria" and the second section is the
"search results"
Now, I've created the search criteria section and the search results
section as partial views, and added a button at the bottom of
index.cshtml, which takes the search results and calls a javascript
function named "Search".
This function executes the search, that is to say it takes the search
criteria input and packages it as arguments into a jQuery.get ($.get)
method call.
This call then reads the response from
SearchResultsController(SearchCriteria myCriteria) and uses the $.html()
to replace the search results in the search results partial view.
The thing is, is this the best way to do this?
Can I have async updates where view A drives view B without using jquery?
Or is Jquery the best way to do it?
I am using the latest jQuery 1.9 build, and the latest jQuery UI.

No comments:

Post a Comment