http - Passing a value with ajax and catching with php -
after 3 days , many lame questions on community,i finnaly understand little bit of ajax post...still couldnt find answer 1 little problem.how catch value passed ajax,with php?
$(document).on('click','tr.listcontractrow', function(e){ var path = $(this).data('path'); $.post("contract.php", {id: path}, function(data){ alert("data sent , received: " + path); }); });
the values sent, i've tested it,the alert shows right value,i checked console log.but somehow cant catch php....:
if(isset($_post['id'])){ $var = $_post['id'] echo $var; }
but without succes.any ideas? update:
echo '<table>'; $row=mysql_fetch_array($query){ echo '<tr class="listcontractrow" data-path="'.$row['id'].'">'; echo '<td></td>'; echo '<tr>'; } echo '</table>';
the visible thing can see there missing semicolon in php:
if(isset($_post['id'])){ $var = $_post['id']; echo $var; }
i replicated code , working in dev environment.
Comments
Post a Comment