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 3 of 3
  1. #1
    New to the CF scene
    Join Date
    May 2012
    Location
    Bangalore, India
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    My AJAX code is not running

    my ajax code is not running!!
    function loadXMLDoc(){
    var xmlhttp;
    if(window.XMLHttpRequest) {
    xmlhttp= new XMLHttpRequest();
    }
    else {
    xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
    }
    if(xmlhttp) {
    xmlhttp.open("GET", "../NewProject/WebContent/html/ajax_info.html", true);
    xmlhttp.onreadystatechange= onReadyState;
    function onReadyState(){
    if(xmlhttp.readyState==4 && xmlhttp.status ==200){
    document.getElementById("myDiv").innerHTML = xmlhttp.responseText;
    }
    xmlhttp.send();
    }
    }
    }

    internet explorer says access denied at the line -
    xmlhttp.open("GET", "../NewProject/WebContent/html/ajax_info.html", true);

  • #2
    Regular Coder
    Join Date
    Aug 2010
    Posts
    945
    Thanks
    19
    Thanked 205 Times in 203 Posts
    you have a typo here

    document.getElementById("myDiv").innerHTML = xmlhttp.responseText;
    }
    xmlhttp.send();
    }
    }
    }
    should be
    document.getElementById("myDiv").innerHTML = xmlhttp.responseText;
    }
    }
    xmlhttp.send();

    }
    }
    But your problem is you don't
    have permission to access
    the file ajax_info.html,
    what server are you using ?

  • #3
    New to the CF scene
    Join Date
    May 2012
    Location
    Bangalore, India
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy

    the code doesn't work on internet explorer.. it says access denied...


  •  

    Posting Permissions

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