In my AJAX book, Understanding AJAX, I spend a lot of time talking about the various programming styles you can use with AJAX. Looking back at the chapter it seems to me there are 2 major styles of programming and large number of varitions depending on what data encodings were using, and where the bulk of our programming actually happens.
Looking at my own day to day development I tend to fall into a couple main approaches.
- AJAX page chunks (sending standard GET/POST requests, and updating part of the page by innerHTMLing in the respose)
- RPC using generated proxies
- Widgeted AJAX using RPC in the background
Looking at these styles I think each can have it place, but I think my decisions on what to use are more and more driven by simplicity. When looking at a problem whats the simplest solution. The more I use AJAX the more I see that its added complexity is its biggest problem. Like any other programming the simplest solution is usually the best one.
I’d like to hear your thoughts on the matter, what AJAX programming styles do you use and why?