ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

what is the shortest possible why to manually get an http request object

December 07, 2007 1:35pm

Subscribe [1]
  • #1 / Dec 07, 2007 1:35pm

    Sally D

    129 posts

    is this the shortest possible way to manually create an ajax object

    ajax=(window.XMLHttpRequest)?new XMLHttpRequest():(window.ActiveXobject)?new ActiveXobject("Microsoft.XMLHTTP"):false;

    Other then using an ajax library what other way is shorter then that?

  • #2 / Dec 07, 2007 10:06pm

    ct323

    1 posts

    Depending on the version of MSXML installed you may have to create an “Msxml2.XMLHTTP” object.  Your code also doesn’t support IceBrowser which uses createRequest().  You may also want to include some try catch blocks for the case when ActiveX is present but disabled.  If you don’t care about the aforementioned then your code looks about as short as it’s going to get.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases