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 4 of 4
  1. #1
    Regular Coder
    Join Date
    May 2008
    Posts
    446
    Thanks
    23
    Thanked 5 Times in 5 Posts

    getting xmlhttp.status 404

    I am trying to get a connection to my php file and currently I keep getting a 404 error.

    Code:
    function loadXMLDoc(id)
    {
    var xmlhttp;
    if (window.XMLHttpRequest)
      {// code for IE7+, Firefox, Chrome, Opera, Safari
      xmlhttp=new XMLHttpRequest();
      }
    else
      {// code for IE6, IE5
      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    xmlhttp.onreadystatechange=function()
      {
          alert('xmlhttp.readyState: '+xmlhttp.readyState+' xmlhttp.status: '+xmlhttp.status);
      if (xmlhttp.readyState==4 && xmlhttp.status==200)
        {
        document.getElementById("left_column").innerHTML=xmlhttp.responseText;
        }
      }
    xmlhttp.open("GET","get_ajax.php?postid="+id,true);
    xmlhttp.send();
    }
    I have the get_ajax.php file in the same directory as my js file that is handling my ajax call

    What am I missing here?

    Thanks alot

  • #2
    Regular Coder patryk's Avatar
    Join Date
    Oct 2012
    Location
    /dev/couch
    Posts
    398
    Thanks
    2
    Thanked 64 Times in 64 Posts
    404 means there's no such document.
    maybe wrong addres?

  • #3
    Regular Coder
    Join Date
    May 2008
    Posts
    446
    Thanks
    23
    Thanked 5 Times in 5 Posts
    thanks for the reply,

    I know what 404 means, just trying to understand why the file is not being found. I guess I could hard code the entire url to the php file to see if it finds it then

  • #4
    Senior Coder Dormilich's Avatar
    Join Date
    Jan 2010
    Location
    Behind the Wall
    Posts
    3,344
    Thanks
    13
    Thanked 349 Times in 345 Posts
    is the HTML page in the same directory as its JS file?
    The computer is always right. The computer is always right. The computer is always right. Take it from someone who has programmed for over ten years: not once has the computational mechanism of the machine malfunctioned.
    André Behrens, NY Times Software Developer


  •  

    Posting Permissions

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