Hello im having trouble of fixing this error Uncaught TypeError: Cannot read property '2' of null
. This is what i want to do, if i click to the day without event the #myModal
will show but if i click the day with event the #delete
modal will show. But my problem is when im clicking the day without event im getting an error of Uncaught TypeError: Cannot read property '2' of null
.
dayClick: function(date, allDay, jsEvent, view) {
var datee = date.format();
$.ajax({
url:'getrecords.php',
method:'POST',
dataType: 'json',
data:{
"filter": 1,
"start": datee
},
success:function(data){
var date = data[2];
if(date == datee){
$('#delete').modal('show');
}
else{
$('#myModal').modal('show');
}
}
});
here's the php
if(isset($_POST['filter']))
{
$start = $_POST['start'];
$select = mysqli_query($con,"SELECT * FROM appointment WHERE start = '$start'");
$check_user = mysqli_num_rows($select);
$array = mysqli_fetch_row($select);
echo json_encode($array);
}