Will AJAX Break MVC
AJAX has done a bunch of things that are good, but as I am quite a fan of the MVC design pattern, I am a little dismayed at the problems I am having fitting my xmlhttprequest object, and the scripts that facilitate it, into my controller.
The problem is that, and the problem could be my faulty understanding of MVC, but I don't really think that's the issue. The way I understand MVC is that anything that is happening on the client should only communicate with your model, and in the larger scheme, your domain through the controller. Events therefore would always call your controller to fire. A simple example of where this would break is if a user clicked on a link to contract a div. You could use a function that would use the style.display attribute. However, the user is generating an event on the client which does not depend in any way on the controller to fire. In fact, there are events happening that affect the view without manipulating any of the back end. This is outside of MVC, but it doesn't have to be.
There are a few ways that I have figured out to make ajax fit into MVC. The first way is that all xmlhttprequests should call urls that exist in your framework. They should never call pages directly. This will provide a higher level of security and keep the xmlhttprequests in the view, although they don't really belong there.
Problems with all of these methods… The first method only works if you have links and forms that reset the pages in order to call new sections of your application. Having the xmlhttprequests call your framework is great, but there is still way too much happening on the client without your controller having any knowledge of it.
The last method is probably the best, but the bridge object would have to be like Fort Knox, and it would also be completely outside of MVC.