Panasonic Youth rob sanheim writes about software, business, ruby, music, stuff and things



Posted
17 November 2005 @ 1pm

Tagged
Ajax, Javascript, Less Code

Discuss

When do you NOT want to use a library for XmlHttpRequest?

Simple question - assuming we are talking about an app that is at least moderately sized (not a one-off or prototype), when would you not want to use a library or some sort of wrapper around the XmlHttpRequest object?

I had some discussions at work recently about this, where I was pushing for DWR and others were pushing for doing straight XHR to Struts actions keep it simpler with "one architecture" for less experienced developers.

What do you think?

(also: yet another way to do xhr, via fueled software (btw, why not use for...each?))

this.createAJAX = function() {
    this.failed = true;
    try {
      this.xmlhttp = new XMLHttpRequest();
      this.failed = false;
    } catch (e) {
      var progIds = ['MSXML2.XMLHTTP', 'Microsoft.XMLHTTP', 'MSXML2.XMLHTTP.5.0', 'MSXML2.XMLHTTP.4.0', 'MSXML2.XMLHTTP.3.0'];

      for (var iterator = 0; (iterator <progIds.length) && ( ! this.success); iterator ++) {
        try {
          this.xmlhttp = new ActiveXObject(progIds[iterator]);
          this.failed = false;
        } catch (e) {}
      }
    }
  };


2 Comments

Posted by
AJAX
19 November 2005 @ 6am

When do you NOT want to use a library for XmlHttpRequest?

Rob asks “Simple question - assuming we are talking about an app that is at least moderately sized (not a one-off or prototype), when would you not want to use a library or some sort of wrapper around the XmlHttpRequest object?”.
<!–a…


Posted by
John McKnight
19 November 2005 @ 1pm

The simple answer is that I do not care for the foreach statement and use it sparingly.


Leave a Comment

Multiple feeds suck - switching to Feedburner and one feed Farewell to Loveline’s Adam