Ok, I'm sure this is really easy and I'm being stupid, but just can't seem to get the bottom of it.
I am trying to make a simple AJAX call to some code in "helpers.php" from my js file called "custom.js". However, I keep getting a 404 error as I don't appear to be traversing the folders correctly, although I'm convinced I am...
The folder structure I have is as follows:
html
index.php
js/
custom.js
includes
helpers.php
And the code I'm using in JS:
$(document).on('ready', function() {
$.ajax({
type: "POST",
dataType: "json",
url: "../../includes/helpers.php",
data: { func: "results", days: "7"},
success: function(rows) {
console.log(rows);
}
});
});
but in the console I get:
The requested URL /includes/helpers.php was not found on this server.
Where am I going wrong, any pointers appreciated...
../includes/helpers.phpas an url? I thing that should work.