I’ve enhanced my CoPilot Waypoint Database Generator to do a bit of AJAX-like coding.

Formerly, after you’d entered all your parameters it would fire off a background task, and then continually refresh a page that would look at the background task’s log file and tell you how many records it had put in the file already.

Now, the refresh page is still there, but if you have Javascript active, it does a window.location= to redirect to an html page which has some javascript that uses the XMLHttpRequest or ActiveXObject to call a perl script that generates a very small XML file that only has the progress, and sets the appropriate div in the page to visible and sets some values in appropriate spans.

It seems to work very nicely, but what a convoluted mess. Between the HTML, the CSS, the Perl, and the Javascript, I’ve got language fatigue. Javascript is not turning out to be my favourite language. I’ve never been able to understand why Sun didn’t sue Netscape over the intentional confusion between Java and Javascript, but now I’m even more confused.

All the other craptacular syntax and bogus object model aside, what Javascript really needs is a simple way to turn a simple bit of XML into an associative array. And don’t talk to me about JSON - even if I wrote both the client and the server, I just don’t feel right about having the client eval a string passed to it by the server - I just know there’s got to be a security exploit waiting to happen. So instead I’ve got all this

var tStatus = xmlDoc.getElementsByTagName("status")[0].firstChild.data;
var tOtherURL = xmlDoc.getElementsByTagName(”otherurl”)[0].firstChild.data;
var tRows = xmlDoc.getElementsByTagName(”rows”)[0].firstChild.data;

That’s just ugly.

4 Comments

  1. Frank Ch. Eigler says:

    Sun suing Netscape? Nah. If it wasn’t for Netscape agreeing to ship an integrated JVM, Java may have gone as far. Another bit of evidence for their friendship is the “JavaScript” name. The language formerly known as “LiveScript” was only renamed after the Sun collaboration timeframe, possibly as some sort of co-marketing scheme.

  2. Paul Tomblin says:

    I never knew that was the time-line, Frank. Still it sucks that such a great language as Java is confused with that POS Javascript.

  3. Rants and Revelations » Oh, buggeration! says:

    [...] In my entry Rants and Revelations : Baby’s first AJAX I crowed about my lovely new AJAX Javascript refresh thing.  It is a thing of beauty and I thought a joy forever.  Until I got an email today from a guy who was generating a database and it suddenly stopped refreshing.  He said it did work until he added another state to the ones he’d done before.  And he also revealed that he was using IE, and was unable to change to Firefox becaused the computer was provided by work. [...]

  4. James says:

    Hi All Experts,
    I want to use AJAX (Asynchronous JAVA script with XML ). How can i Optimize the site SEO.
    as Java script and flash is not recommended by search engines. Any suggestion or help is welcomed. With Regards.

Leave a Reply