Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jun 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs down XMLHttpRequest in IE vs Chrome and FF

    The following script works in FF and Chrome But in IE7 and IE9
    XML DOM returned by xmlhttp.responseXML is always empty.
    What am I missing?
    This is the first time I've worked with XML, and I'm pretty green with js.

    var xXml;
    function LoadSelectList(url)
    {
    if (window.XMLHttpRequest)
    {// code for IE7+, Firefox, Chrome, Opera, Safari
    var xmlhttp=new XMLHttpRequest();
    }
    else
    {// code for IE6, IE5
    var xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
    var openstat = xmlhttp.open("GET",url,false);
    var sendstat = xmlhttp.send();
    xXml=xmlhttp.responseXML;
    var x = xXml;
    }

  • #2
    Regular Coder
    Join Date
    Aug 2010
    Posts
    972
    Thanks
    19
    Thanked 212 Times in 210 Posts
    Quote Originally Posted by HWorby View Post
    The following script works in FF and Chrome But in IE7 and IE9
    XML DOM returned by xmlhttp.responseXML is always empty.
    What am I missing?
    This is the first time I've worked with XML, and I'm pretty green with js.

    Code:
    var xXml;
    function LoadSelectList(url){
    	if (window.XMLHttpRequest){
    	  var xmlhttp=new XMLHttpRequest();
    	}else{
    	  var xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    	}
    	var openstat = xmlhttp.open("GET",url,false);
    	var sendstat = xmlhttp.send();
    	xXml=xmlhttp.responseXML;
    	var x = xXml;
    }
    Im gonna guess that you are running
    this from your file system. That code will
    not work for ie on the file system but
    will work from a server.

    If you are trying this
    without a server see this ....
    Load an XML File - Cross-browser
    Last edited by DaveyErwin; 06-13-2012 at 07:46 PM.


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •