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