I am trying to make a calendar to show the wash status of the cars of the specific days of the month. The days are assigned according to the package selected by the user. I am using Full Calendar for this purpose, but somehow my AJAX call returns nothing and I am stuck badly. Any help will be appreciated. All files and dependencies are properly linked.
Main FullCalendar CODE:
<script>
$(function () {
var zone = "08:00";
var date = new Date();
var d = date.getDate(),
m = date.getMonth(),
y = date.getFullYear();
$('#calendar').fullCalendar({
header: {
},
eventSources: [
{
url: 'process.php',
type: 'POST',
error: function() {
alert('There was an error while fetching events.');
}
}
],
editable: false,
droppable: false,
});
});
</script>
and my Process.php code:
<?php
include('db_connect.php');
session_start();
if(isset($_SESSION['userSession'])!=""){
$user_id = $_SESSION['userSession'];
$query = "select * from wash WHERE clientid='$user_id'";
$res = mysql_query($query) or die(mysql_error());
$events = array();
while ($row = mysql_fetch_assoc($res)) {
$wid = $row['wid'];
$start = $row['wash_date'];
if($row['wstatus'] == 0){
$title = "Wash Scheduled";
$backgroundColor = "#f39c12";
}
else if($row['wstatus'] == 1){
$title = "Wash Done";
$backgroundColor = "#00a65a";
}
$eventsArray['wid'] = $wid;
$eventsArray['title'] = $title;
$eventsArray['start'] = $start;
$eventsArray['backgroundColor'] = $backgroundColor;
$events[] = $eventsArray;
}
echo json_encode($events);
}
?>
Kindly resolve.