M Argus Chopin Gyver M Argus Chopin Gyver - 1 month ago 13
Ajax Question

AJAX POST 500 Internal Server Error on hosting

I'm develop something that need some data to load on AJAX (using POST method).

When I'm build the code on localhost (using XAMPP on Windows 7). It works pretty well.

But, when I'm moved the code to hosting server, It give me a 500 Internal Server Error..

Here's the code that send the AJAX Request

$.post("the-link-to-ajax-handler",
{
//some parameter
roomid : roomid,
amenities : amenities,
},
function(data){
//process that I do when ajax complete
}


And here's the AJAX Handler (using PHP)

$roomid = mysqli_escape_string($conn, $_POST['roomid']);
$amenities = mysqli_escape_string($conn, $_POST['amenities']);
echo $roomid."<br/>".$amenities;die();


*I'm trying to print the parameter but no luck, I'm still get the 500 Error

Screenshot of Network Panel from process on hosting
enter image description here

And here's the Screenshot Network Panel from process on localhost (definitely with the same code)
enter image description here

Answer

1) Are you missing any javascript plugin files or the plugin files path is not defined you faced the 500 internal server error.

2) Hosting server is Case Sensitive check the Variable values.

3) If you move to ajax before alerting the flow.

Comments