Shortest way to create an XMLHttpRequest object

This should work in everything, I think, to get an XMLHttpRequest object for JavaScript in your browser: http = window.XMLHttpRequest ? new window.XMLHttpRequest : (window.ActiveXObject ? new ActiveXObject("MSXML2.XMLHTTP"): null); Of course, this only applies if you’re not using a library to make all this stuff go away, which you maybe should be. But if you’re not, this is a very short way to get the thing you need for Ajax.

I'm currently available for hire, to help you plan, architect, and build new systems, and for technical writing and articles. You can take a look at some projects I've worked on and some of my writing. If you'd like to talk about your upcoming project, do get in touch.

More in the discussion (powered by webmentions)

  • (no mentions, yet.)