Getting all AJAXy

posted by Jeff | Tuesday, January 29, 2008, 12:07 AM | comments: 0

I spent the evening doing a great deal of refactoring on the forum app to try and tame the Javascript mess I created with AJAX stuff. The goal was to use the ASP.NET AJAX framework because it's now a supported and shipping piece of ASP.NET.

Trying to use Javascript in an object-oriented way is already really strange, but once you get the hang of it, specifically how the framework wants you to use it, it becomes suddenly very obvious. I'm really surprised at how well thought out this framework is. Well, maybe not, because in the contact I've had with those cats at Microsoft in the last couple of years, you only wish they were cloned to work on Windows Shista.

So the script pieces and their server counterparts are all lining up nicely now, compiled into an assembly and loaded as needed. The sweetest thing, and something I had not messed around with prior to tonight, was exposing a Web service and consuming it with script. It's awesome. An extra attribute on the Web service class serializes everything as JSON, and then in script it's like the resulting object is exactly what you had server side. So to load a post quote, I can just do something like $get("textBox").value = result.Title. It's too ridiculously easy.

What excites me about this is that if there were just more hours in the day, I could make some really interesting stuff. It's a ton of fun.


Comments

No comments yet.


Post your comment: