how to use jquery variable in php
Try this one:
<html>
<head>
<script src="jquery.js"></script>
<script>
$(document).ready(function(){
var id = 23;
$("#submit").click(function(){
$.ajax(
{
url: "B.php",
type: "POST",
data: { id1: id},
success: function (result) {
alert('success');
}
});
});
});
</script>
</head>
<body>
<form >
<input type="button" id="submit" name="submit"/>
</form>
</body>
</html>
Then B.php
<?php
$a =isset($_POST['id1'])?$_POST['id1']:'not yet';
echo $a ;
?>