1
I am trying to make a POST query with jquery on my website online but I get the error message 500 Internal Server Error, this is the query (jquery):
$('#background').load('map_page.php', {'a':'see_member', 'id': id});
The block that receives this query on the map_page.php page (php):
if($a == 'see_member') {
$id = @$_POST['id'];
if($id) {
$q = $dbAgent -> query("select * from map where id=$id");
$a = $dbAgent -> fetch($q);
$logo = $a['logo'];
$title = $a['name'];
$desc = $a['description'];
$address = $a['address'];
echo "
<a href='#' onclick='closeCompany($id)'>
<img src='media/cancel.png' id='close'>
</a>
<img src='$logo' id='prof'>
";
$r1 = $a['rate_1']; $r2 = $a['rate_2'];
$r3 = $a['rate_3']; $r4 = $a['rate_4'];
$r5 = $a['rate_5'];
$allStars = array(
0=>0, 1=>$r1, 2=>$r2, 3=>$r3,
4=>$r4, 5=>$r5
);
$biggestStar = 0;
for($i=1;$i<count($allStars);$i++) {
$st = $allStars[$i];
if($st > $allStars[$biggestStar]) {
$biggestStar = $i;
}
}
$NUM_STARS = 5;
if(!$clientTools -> rated($id)) {
echo "<span class='rate_stars' id='rate_stars' onmouseenter='setVoteAble($NUM_STARS,$id)'
>";
}
else {
echo "<span class='rate_stars' id='rate_stars'>";
}
for($i=1;$i<count($allStars);$i++) {
if(($allStars[$i] < $allStars[$biggestStar] and $i < $biggestStar) or $i == $biggestStar) {
echo "<img class='rate_star' id='rate_star_$i' src='/media/star_fill.gif'>";
}
else {
echo "<img class='rate_star' id='rate_star_$i' src='/media/star_bg.gif'>";
}
}
$numVotes = $allStars[$biggestStar];
echo "<br><span id='numVotesStars'>$biggestStar estrelas. ($numVotes votos)</span>";
echo "</span>";
echo "
<div class='p_map'>
</div>
";
echo "
<div id='cont'>
<center><text id='header'>$title</text></center>
<br><br>
<text id='content'>$desc</text>
<br><br>
<text id='content' style='font-weight: bold'>$address</text>
</div>
";
return;
}
}
Place this code at the beginning of your php file to verify the error and refer to your browser URL, then edit your question with overro: ini_set('display_errors', 'On'); error_reporting(E_ALL);
– Giancarlo Abel Giulian
Nothing different, just to remember the page normally loads the part, only with the query happens this.
– Junior CT
Go to the url directly in the browser map_page.php? [PARAMETROS] and see the error that will be shown. Post the error if you cannot identify the problem..
– Alexandre Previatti
@Juniorct when you have snippets of code to show, do not use external links like Pastebin, but post the code here so that the question is not invalidated if the link is lost.
– Jedaias Rodrigues
On which line is the error?
– rray