Reputation: 23
I'm using Ajax request for a project and i has lot of problem to make it working I sommetime receive some error 500 (Internal Server Error), but finally everything works until I wanted to move my scripts into a directory.
Here is my Ajax works :
var xhr = getXMLHttpRequest();
xhr.onreadystatechange = function() {
if (xhr.readyState == 4 && (xhr.status == 200 || xhr.status == 0)) {
callback_like(xhr.responseText, receive);
location.reload();
}
};
xhr.open("POST", "like.php", true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
var data = "like=" + receive;
xhr.send(data);
And this one doesn't work :
var xhr = getXMLHttpRequest();
xhr.onreadystatechange = function() {
if (xhr.readyState == 4 && (xhr.status == 200 || xhr.status == 0)) {
callback_like(xhr.responseText, receive);
location.reload();
}
};
xhr.open("POST", "script/like.php", true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
var data = "like=" + receive;
xhr.send(data);
Error message in the console : POST: 'url' 500 (Internal Server Error)
I already tried to set all the right to the directory but nothing change..
Thanks
Upvotes: 1
Views: 522
Reputation: 335
An internal server error means that there is probably an error in your code. Any references or includes of other files that need to be adjusted? If the file wouldn´t be found you´d get a 404 Not Found in your response.
Enable error output in php to get a more detailed error message from php.
Upvotes: 1