I want to convert a javascript variable to a php variable.
This is the jQuery code I use:
$('#add').click(function(){
$.post(
'user.php',
{saveidnumber: idnumber},
function(){
console.log('done')
}
);
});
php:
if(isset($_POST['saveidnumber'])){
$saveid = $_POST['saveidnumber'];
echo $saveid;
}
It look likes the jQuery work because there are no errors in the console but the php never echo's the $saveid variable.
What am I doing wrong?
function(res){ console.log(res); }