I have one question.. I want to pass javascript variable to php script, on the same page as javascript is located... I have second code:
<script type="text/javascript">
function getID(i)
{
var table = document.getElementById("tblPersons");
var row = table.rows[i];
alert(row.id);
//window.location.href = window.location+"?id="+row.id;
$.ajax({
type: 'POST',
url: 'index.php',
data: {'variable': row.id},
});
}
</script>
$selected_row = $_POST['variable'];
echo $selected_row;
}
but if I try to var_dump $_post['variable']
, I got null in echo...
so can anyone help with my problem?