Problem in passing Jquery variable to php .
When i pass variable id to B.php
i am getting this error
"Notice: Undefined index: id1 in C:\xampp \htdocs\PhpProject1\OtherUsableItems\B.php on line 2
How to solve this problem ???? This A.php
<html>
<head>
<script src="jquery.js"></script>
<script>
$(document).ready(function(){
var id = 23;
$("#submit").click(function(){
$.post("B.php",
{
id1: id,
} );
});
});
</script>
</head>
<body>
<form action="B.php" method="post" >
<input type="submit" id="submit" name="submit"/>
</form>
</body>
</html>
This B.php
<?php
$a =$_POST['id1'];
echo $a ;
?>
I want id variable to pass on to B.php