Friday, October 19, 2007

Is It AJAX yet?

Yes, the AJAX saga continues. ;)

I'd spent the majority of Wednesday night getting php to talk to mySQL, so last night I'd finally get to work on my AJAX material. Or so I thought.

My approach was going to be:
  1. start off with a simple php application (a search form page and a results page).
  2. convert simple php application into an AJAX version.
Turns out, simple is a relative term. I'm tempted to make some generalized statement like, "PHP is harder than ColdFusion," except I think it's more of a case of what one is already familiar with versus working in unknown territory.

It took all night, but I finally have a simple php application. The first page has a drop down list of various red wines-- dynamically generated from a query in my database, thank you very much. The user selects one of the wines from the drop down list and hits the submit button, and then they are taken to the "results" page where they can see all the relevant info about the wine they've chosen (temperature, body, taste, etc.)

This morning, I just happened to wake up early and I decided to take a stab at converting the app over to AJAX. I wound up saving copies of my pages before I did any work, just in case I screwed up something. I managed to strip the HTML out of the results page, and converted it so it returns only the bare minimum response in valid XML. I'm on my way-- but, of course, the alarm clock just went off, so I've run out of time to work on this for now.

It's not the darn AJAX itself that's taking so long, it's all the prep work leading up to working on it. It's mildly frustrating, but I guess I'm learning some things out of this.