I am using a jquery calendar that looks like this:
$(document).ready(function () {
$('#calendar').eCalendar({
weekDays: ['Dim', 'Lun', 'Mar', 'Mer', 'Jeu', 'Ven', 'Sam'],
months: ['Janvier', 'Fevrier', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Aout', 'Septembre', 'Octobre', 'Novembre', 'Decembre'],
textArrows: {previous: '<', next: '>'},
eventTitle: 'Evenements',
url: '',
events: [
{ title: 'title', description: 'description', datetime: new Date (2015,07,01)}
]});
});
</script>
To get the events, I connect to a mysql database and store the result in a php variable such as:
$event={ title: 'title', description: 'description', datetime: new Date: (2015,07,01)};
I can't figure out how to put this $event into the jquery script so that it reads it.
I tried for exemple:
$(document).ready(function () {
$('#calendar').eCalendar({
........
........
events: [
<?php echo $event ?>
]});
});
Which doesn't work. Any idea?
Thanks
$eventhas the correct value, it should work. Can you post the output of your browser in the question (source code)?'<?php echo $event ?>'?<?php echo json_encode($event); ?>