Stoyan Stefanov, one of the leading JavaScript developers at Yahoo!, wrote this interesting article about the implementation of the MVC design pattern with PHP and Ajax. This article confirmed the fact that Ajax requests should be always treated sequentially. In fact, an Ajax action always takes place after a specific HTTP request. For example, if you have a GET request which has the form of a request=action
parameter, then your server-side script must process this request by using its HTTP parameter handling (in PHP, you can either use $_GET
or $_REQUEST
).
Personally speaking, I prefer to use $_REQUEST
because it doesn't matter if the request is GET or POST. Most PHP frameworks, like Zend, have specific classes to handle Ajax requests, so it's better to stick to those frameworks if you want to spare some time instead of worrying about the underlying implementation of a MVC pattern. Anyway, Stoyan's article is really useful, especially if you want to buy some little Ajax application.