26 February 2005

Cleaning TypeKey With Some Ajax

I couldn’t help but notice a bit of a delay in loading this site’s entry pages … like this one. Go ahead, load the complete entry and keep your eye on the “Post a comment” part (or even the sidebar, whichever is in view).

Seems to pause midway for a few seconds, doesn’t it? Actually, it depends, but sometimes I’ve seen it take as long as five seconds. I don’t know about you, but that’s almost five seconds too long in my book.

What’s up with that? It appears to be the Movable Type Comments CGI fetching the TypeKey signin status mid-page, that’s what’s up. Sure, I could get rid of TypeKey support … but I’ve got nothing against TypeKey. I’d rather just get rid of the delay. What to do?

Sounds like a job for some Ajax!

The technique has actually been around for a while, but is only recently making some serious waves thanks in no small part to Google Suggest and Google Maps and who knows what else by now.

The term Ajax was coined by the fine folks over at Adaptive Path. It’s short for “Asynchronous JavaScript + XML”* - and AP founder Jesse James Garrett took the time to craft a rather lucid explanation of what it’s all about. If this is all news to you, and you’re the least bit interested in client-side scripting, by all means do yourself a favor and read the essay, stat. (<Australian accent>: “It’ll change your life.” Hmm, can’t seem to remember where I first heard that - oh well …)

Back to TypeKey. I thought this would make a good candidate for a few reasons. One, the signin status already uses client-side scripting. Two, the aforementioned delay. Three, it’s something new to explore (aka “because I can”).

So here it is, straight from the sandbox, my first at-bat using Ajax with Typekey. My head’s already spinning with several next steps for improvement, both for this specific application and the XML HTTP request library in general (creative use of anonymous functions, anyone?). Nevermind that for now - you have to start somewhere. Enjoy.

* As for me, I tend to call it ECMAScript, not JavaScript. Then again … hmm, Aecx? (Right - Ajax it is.)

Posted by joe at 08:46 PM

Trackback Pings

TrackBack URL for this entry:
http://www.joesapt.net/mt/mt-tb.fcgi/8

Comments

Six Shop, MT-SpamLookup, etc from Linotipo:

Decía ayer que tenía en cola para comentar muchas cosas, aquí van las relacionadas con Six Apart. Hoy se anuncia el lanzamiento del servicio de blogs de Club-Internet (T-Online Francia), que como era de esperar, utiliza TypePad. Lo cuenta Loic:...

08:21 PM, 20 April 2005

Using Ajax with TypeKey from Six Apart Professional Network:

Since anything worth doing on the web is worth doing with Ajax, Joe D'Andrea's written up his technique for using Ajax with TypeKey. It's a clean and simple implementation of the authentication service, and it's found a good home on the Everything Type...

08:34 PM, 20 April 2005

Comments are closed for this entry.