I need to get id from table row by clicking on that row and use that id in another php file. For this I was getting id by jquery, the code is
var id = $(this).closest("tr").find('td:eq(0)').text();
// it's working
And I want to pass this id as php variable. But any one isn't work. My code is:
$(document).ready(function(){
$("#people-table tr").click(function(){
var id = $(this).closest("tr").find('td:eq(0)').text();
$.ajax({
url: "default_people.php",
type: "GET",
data: { id1: id},
success: function (result) {
alert(id);
}
});
});
});
And my php code is:
$a = $_GET['id1'];
echo $a ;