Rahgav Rahgav - 2 months ago 5
PHP Question

Sending PHP value in ajax

I want to send PHP value using ajax but it is not running .Please Help.

$.ajax({
url:"getuser.php",
type:"GET",
data:{ id2: name2,id:<?php $_GET['id']; ?> },
success:function(data){
$("#detail").html(data);

}
});

Answer

change

<?php $_GET['id']; ?>

to

<?= $_GET['id'] ?>

or

<?php echo $_GET['id']; ?>
Comments