I’m using AJAX in my web application. However the documentation says to
instead of this:
var req = new XMLHttpRequest();
do this:
var req = Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"]
.createInstance(Components.interfaces.nsIXMLHttpRequest);
Why is it better that I do this? What is the difference?
Thanks in advance.
Guessing that your read this …. That remark is valid for XPCom modules, ie modules that live inside a Mozilla application. Not for web applications, so you should stick to the standard calls, or use some JS framework to shield you from differences between browsers.