XMLHttpRequest and Internet Explorer 7

Does XMLHttpRequest work the same in IE7 as it doesn IE8?

Would the following code work the same?

  $objX = new XMLHttpRequest();

        if ($objX != null) {

            $objX.open("GET", "json/low-resulution-images.json ", true);

            $objX.onreadystatechange = function () {

                //if readyState is not 4 or or status not 200 then there is a problem that needs attending
                if ($objX.readyState !== 4) {

                    if ($objX.status !== 200) {

                        alert('HTTP error ' + $objX.status);






        } else {

            window.alert("AJAX  not supported.");


I don’t have a native version of IE7 so it is difficult for me to test for sure

If you put IE8+ in compatibility mode, I think it emulates IE7.

In IE, You can use XDomainRequest instead of XMLHttpRequest

You would only do that for cross domain requests - you don’t need it for requests within the one domain. The standard XMLHttpRequest() works with IE7+ the same as it does with other browsers within the same domain.