I am using a jquery plugin called Calendario. Currently the file the data is being pulled from is formatted like this.
var codropsEvents = {
'04-25-2016' : 'The Big Test>'
};
I would like to pull in data from my database for the events. The PHP file I have is formatted like this...
$results = $connection->query("SELECT id, eventid, name, date FROM
visitevents");
$events = array();
foreach($results as $event){
array_push($events, $event);
}
echo json_encode($events);
How can I set up my data file to import the json data for all the events on my database.
First head over to https://github.com/deviprsd21/Calendario get the latest version. Then read through the docs.
Basically you do a ajax to get all your events and then $('#calendar').calendario('setData', data, clearData)
pass your events in data
and clearData
is a boolean, if true all the previous events will be cleared and if false the new data will be merged with the old ones