MVC and AJAX
I have recently been learning about the new MVC framework offered by friends at ASP.NET. One of the first questions I had about it was how does AJAX fit into this framework. So, I did a little digging. I found Nikhil Kothari's article on "Ajax with the ASP.NET MVC Framework," but that is not quite what I was looking for.
(Awhile back, I stumbled across Rob Bagby's webcasts on the ASP.NET AJAX client libraries wherein he details the benefits of getting your hands dirty with the JavaScript, instead of letting the UpdatePanel control write all the JavaScript for you. And he goes into detail on how to accomplish that task. He didn't need to do much convincing of me. I've long thought that while the UpdatePanel is very convenient (especially for those who loath JavaScript), it is probably somewhat bloated. In the end, I prefer Rob Bagby's way.)
I was looking for a method that fit within the MVC framework, but didn't deliver HTML from an AJAX call, but rather straight XML, or better yet JSON. I did some more searching and found that Aaron Lerch celebrated the new year with a post titled Unifying Web "Sites" and Web Services with the ASP.NET MVC Framework, wherein he describes how one could go about returning XML or JSON through the MVC framework by simply passing the data to a view and the view determining what form it should send back to the client. I downloaded his provided code only to find that it doesn't work with the latest version of the MVC framework. (Not that this is a big deal. I'm sure I could just study the new framework and re-write it.)
I also found this interesting post by Dan Finch in the forums. It is basically the same concept that Aaron proposed, only less code.
I don't know which is better yet. I'm just learning about this stuff. But I do like how these solutions deliver XML or JSON and they use the MVC framework to deliver it. I'll be keeping an eye out for more like this.