Terminally Incoherent

Utterly random, incoherent and disjointed rants and ramblings...

Wednesday, February 22, 2006

AJAX and me

As part of my job I do some development on web applications. Mostly LAMP and WIMP shit. I'm not a graphics designer though, and my Photoshop skills are limited. This is something that I plan to work at, but for the time being I usually opt for a simple css layouts with minimal amount of graphics.

My philosophy for the most part is to use the database and php to do the heavy lifting, and leave the client side simple and basic... This approach is good for most websites, but some web applications written this way suffer from the click-refresh-click-refresh issue. My users were complaining that they spend more time waiting for the page to reload after they submit a form, than they used to when working with their old spreadsheets and hand written forms.

On of the ladies at work asked if it would be possible to redesign the page so that she can make changes without constantly reloading it... Yes, it is possible - it is called AJAX. I avoided AJAX for all this time, but it just caught up with me.

As much as I hate working with javascript, this is the direction where the web applications are going right now. So I spent my day today doing my first, shaky steps in the AJAX land. It is not as bad as I thought.

AJAX essentially boils down to few basic asynchronous request calls, and everything else just builds on top of that. You can actually accomplish some really cool stuff with just few lines of javascript. So it is not all bad.

I produced a functional app today, but I'm still having trouble with few things. For example, I'm still not sure how to get a pointer to the DOM object that generated my asynchronous call, in the event handler that updates my page after I get the data back from the server. Most samples I have seen on the web simply use the getElementByID method but that does not really work for me. I have oodles of text fields on the page that can generate AJAX requests, and I need to update them accordingly.

When I marked them with unique id's and passed that ID to the server so I can pass it back to javascript again, I run into some bizarre XUL issue with firefox. That and IE 5.0 refused to display my page at all for some reason :P

I will need to work out few of those issues, but so far I'm happy with the progress. I'm learning some new stuff. I plan to look into some of the existing AJAX libraries out there. Maybe I can lean on some more mature code, and have it do most of the dirty work for me as I work on this project :)



0 Comments:

Post a Comment

<< Home