Ajax poste und erhalte Checkbox-Wert
Ich habe diesen Code:
<script type="text/javascript">
function processForm() {
$.ajax( {
type: 'POST',
url: '/ajax/checkbox.php?name=foton',
data: { checked_box : $('input:checkbox:checked').val()},
success: function(data) {
$('#message').html(data);
}
} );
}
</script>
<input type="checkbox" name="foton" value="1" onclick="processForm()">
checkbox.php Datei:
$checkbox = intval($_POST['foton']);
if($checkbox == 1){
mysql_query("UPDATE users SET sekretessFoton = 1 WHERE userID = $memberID");
}else{
mysql_query("UPDATE users SET sekretessFoton = 0 WHERE userID = $memberID");
}
Das Problem ist, dass ich keinen Wert von $ _POST ['foton'] bekomme. Was ist falsch?
Vielen Dank