My name is Rob Cherny and I'm a professional Web Developer with 16 years of experience creating Web sites and Web-based applications. This site is where I write about my work, and random other things...

Learn More


Close Tab

Web Development

Ajax Object Script Needs Update

This is just a quickie. Over on the Microsoft Internet Explorer Weblog they've previously posted talking about how IE7 will actually offer "navtive" support for the XMLHttpRequest() object, meaning, you won't have to do this anymore:

  1. var x = new ActiveXObject("Msxml2.XMLHTTP");

So, you'll be able to directly call it like in all the other browsers:

  1. var  o = new XMLHttpRequest();

So now they've pointed out you should call that first. Excellent point. What's the most common way to call the object then? Directly.

Point being, it'll be much more efficient to call the native object first, see if that's been successfully defined, then move on to your script and never touch ActiveX. Plus, with all the security concerns these days, who knows if ActiveX will even be working full on. Long shot concern, but who knows.

It just got me thinking about my JavaScript Ajax Object, and wondering what order I declared things in.

Checking into it, sure enough, I'm doing the ActiveX call first, so I'll have to update mine.

I hope to get to it soon. As someone out there might know ... been a little busy these days...

Anyway, you might want to check your scripts too.

Update: I've updated my script with the above change in order. It should be good to go, but please let me know if there's any problems found with it.

Jun 9, 09:16 AM in Web Development (filed under Ajax, JavaScript)

commenting closed for this article

In This Section