Hi I am trying to know whether the checkbox is checked so I can display a message and if not another message will got displayed. I tried several times and it didn't work. It will just alert True when I check and uncheck.
AJAX code:
$('#check').click(function(){
var check= $(this).val();
$.ajax({
url: './opt/index_opt.php',
type: 'POST',
data: {check:check},
success: function(data){
alert(data);
}
});
});
This is my PHP file:
<?php
session_start();
include "../db.php";
$user= $_SESSION['id'];
if(isset($_POST)){
$check = $_POST['check'];
if(isset($check)){
echo 'True';
}else{
echo 'False';
}
}
?>