Hi,
Right now I am using mvc action's to handle ajax requests (not like I have another option...but just seems kinda wrong)
It just seems odd since there is no 'view' to the action.
Hi,
Right now I am using mvc action's to handle ajax requests (not like I have another option...but just seems kinda wrong)
It just seems odd since there is no 'view' to the action.
Yep. That's how this framework works. Theres the Controller.JSON
function that will return a JSON object.
There is a "view" -- just not necessarily an HTML view. The results can be returned as a raw string, JSON, HTML, XML, etc. These are all presentations (views) of the data, but not necessarily ones that are directly renderable in a browser.
One of the benefits of MVC is that controller is not tied to any particular view implementation. Its job is to receive requests and package up data to be sent back to the View. Whether that happens to be an AJAX call, a web page, and XML page or something else is totally irrelevant to the Controller. Its separation of concerns.