I have some data, processed with javascript that I want to write to a database. So I'm trying to code something with ajax. But with no luck...
What I need: I have two variables (id, naam) that I want to pass to a php-script. Nothing more...
<script type='text/javascript'>
function geefNaam(id, naam)
{
$.ajax({
type: "POST",
url: "schrijfrecord.php",
data: { id: id, naam: naam },
})
}
</script>
and I call this function...
geefNaam(id, naam);
my php
<?php
$id = $_POST['id'];
$naam = $_POST['naam'];
echo $id;
echo $naam;
?>