Search code examples
phpjqueryajaxphonegap

cannot post /file.php with ajax request


My request returns a 404 Not Found when I send an AJAX POST request. I cannot POST /accountf.php. This is my code:

$.ajax({
  url: 'accountf.php',
  data: {
    "getclient": true
  },
  type: 'post',
  success: function(output) {
    alert(output);
  },
  error: function(xhr) {
    alert("An error occured: " + xhr.status + " " + xhr.statusText);
  }
});

However when I use get it returns the whole PHP file in response.

enter image description here


Solution

  • i just change the request path to my xammp htdocs folder and paste my php files there now its working
    as

    $.post('http://localhost/bizmanager/backend/accountf.php',
            { "getclient": true },
            function(data,status){
                alert("Data: " + data + "\nStatus: " + status);
            });
    

    thank you guys