Code wise correction is As mentioned in above answers is change below line:
<?php $_GET['id']; ?>
to
<?php echo $_GET['id']; ?>
But make sure you will pass id as url parameter since you use $_GET method to assign value . For example:
http://localhost/YOUR_PROJECT_ROOT_DIRECTORY/filename.php?id=121
This must work.
Sample full functional code is below:
<a href="javascript:void(0)" onclick="test();">Click here</a>
<script src="http://code.jquery.com/jquery-1.11.1.js"></script>
<script>
function test(){
$.ajax({
url:"getuser.php",
type:"GET",
data:{ id2: "1",id:<?php echo $_GET['id']?> },
success:function(data){
$("#detail").html(data);
}
})
}
</script>