A quick example of how it can be combined for a Zend Framework application (and this is from a demo application that I wrote a few months ago):
- Use the MCV Framework to create a fully functional site (which works without javascript).
- Modify the controller to understand the difference between a βnormalβ request and an AJAX request (switching the Zend context makes this easier).
- Add Javascript (in my jQuery example) to cleanly replace links with AJAX events.
After all, a PHP application knows that an AJAX response is needed for an AJAX request (less bandwidth, less processing, only a JSON or HTML fragment), but a regular request requires the entire generated page.
Basically, you just use AJAX to request (or update or add data) the 'view' template without having to process the entire layout. The Zend Framework Context Switch Assistant can help make this more sense.
It is worth noting that context switching works well, making the request available in different formats - HTML / XML, CSV, etc.
source share