Over the past few days, I've noticed an increase in questions about using the new AJAX capabilities of ColdFusion 8. This is great, it means people are playing with the new version. The AJAX functionality it brings to the table are quite amazing, and it makes using AJAX a snap.
However, once people have the CF8 AJAX elements talking to the server, some confusion seems to arise. I believe this confusion is coming from a misunderstanding of the two types of AJAX requests. I see AJAX used in two ways, and how you want to interact with the server depends on what you need to do.
First there are AJAX data requests. These are requests for pure data, to be used when populating a select box, grid, etc. There is no display content here. In this case, I don't think it makes sense to try and send requests to your application controller (such as Fusebox). The UI Controller frameworks are first and foremost meant to generate content: images, tables, styles, text, etc. So when your AJAX control just needs data, bypass the UI Controller. By the way, this is also the case when the request is for Flash Remoting or a web service. For AJAX data requests, the following image shows the sequence I follow:
Hopefully this explains the different ways you would interact with the server depending on what you're using AJAX for. Ideas or comments welcome, as always.