While trying to create my website as dynamic and with as few page reloads as possible, I've come to enjoy the use of partial views with AJAX - reloading or updating part of the page with AJAX GET or POST. However (being new to MVC in general) I've started wondering - is this the right approach.
Say there's the given scenario:
I have a table, on this table I have a button "View Details". When user clicks on this button, I want to retrieve information from the server and display it in a modal window.
I could do one of the following:
- Create Details Partial View from model, execute AJAX GET to retrieve form from it on button click and place it inside modal window.
- Create an action that returns JSON with necessary information, use AJAX to get it and populate modal form with it.
Which approach would be the correct one?