Search code examples
phpajaxhttp-status-code-404

Ajax call to PHP function not calling function (file is 404 not found)


I have a web page that the user can select a team and when they do, I want an image.src to change to reflect the new choice. When the user makes the change, the teamID is saved in a settings file. I can't get the AJAX call to access the PHP file or function. When it makes the AJAX call it looks like it can't access the PHP file- I get an error POST: http://192.168.1.104/.....functions.inc.php 404 not found - I tried every path I could think of to get to the functions.inc.php file but it didn't work. Here is the Ajax code: (the functions.inc.php file is in the same directory as this file)

 function updateLogo(){
     <?error_log("In update logo "); ?>//test to see if it gets in the function
    $.ajax({ 
        url: 'functions.inc.php',
        data: {action: 'getLogo'},
        type: 'post',
        success: function(output) {
            alert(output);
         }
    });  
    alert (output);   
    document.getElementById('teamLogo').src = 'output'; 
  }

Any suggestions?


Solution

  • Because the device is running its own PHP server and deamon, the correct url is a unique url to this device.

    Thanks for the help