Text from php variable into javascript function -
i using jquery calendar looks 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 events, connect mysql database , store result in php variable such as:
$event={ title: 'title', description: 'description', datetime: new date: (2015,07,01)}; i can't figure out how put $event jquery script reads it.
i tried exemple:
$(document).ready(function () { $('#calendar').ecalendar({ ........ ........ events: [ <?php echo $event ?> ]}); }); which doesn't work. idea?
thanks
you have sure $event string. bet array, please provide vardump($event);to sure of that.
if array, try in place of <?php echo $event; ?>;:
<?php echo serialize($event); ?>;
Comments
Post a Comment