I'm trying to do an ajax call from a javascript file to a PHP file.
This is the code i have:
function testAjax()
{
$.ajax({
type: 'GET',
url: 'http://127.0.0.1:81/Gorillo/account/test',
success: function(data)
{
alert("Success");
},
error: function(err)
{
console.log(JSON.stringify(err));
}
})
}
The function in the PHP file:
function test()
{
echo "hello";
}
In my browser console i get the following error upon running the code:
{"readyState":4,"status":404,"statusText":"error"}
However, when i use XDebug to debug the code, i can see the PHP code is being executed by placing breakpoints. This means the ajax call does find the PHP file/function.
Why do i get a 404 error?
Regards