Here I'm trying to customize the json feed url that is usually given. I want to add an input data as a GET request to the php file events.php
The script:
<script>
$(document).ready(
function eventcaller() {
$('#calendar').fullCalendar(
{
events: 'events.php?room='+$( "#room_num" ).find( "option:selected" ).prop("value"),
header: {
left: 'prev,next,today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
defaultView: 'agendaWeek'
});
}
);
</script>
events.php:
$room_num = $_GET['room_num'];
//I do queries and get an associative events array exactly the way fullcalendar likes it
$events=array();
echo json_encode($events);
html:
<select class="select form-control" id="room_num" name="room_num" onchange="eventcaller()">
<option value="0">Select a room</option>
<option value="1">1</option>
// and so on.
</select>
I get the following error in the console:
Uncaught ReferenceError: eventcaller is not defined
Pointing to the html select tag where I mentioned onchange.
I don't understand what is my mistake here. If there is an alternate method to get my job done, I'll be more than happy. Thanks in advance.