I have got a javascript(jquery) file called custom.js in which i am using:
(function ($) {
$(document).ready(function () {
$('.days').countdown({
until: directorDate,
layout: '{dn} {dl}',
timezone: +7
});
$('#weather').openWeather({
city: 'directorCity //The city is in a string.It used to be 'New York,US'
placeTarget: '.weather-place',
iconTarget: '.weather-icon',
customIcons: 'dark/files/img/icons/weather/'
});
});
})(jQuery);
In my header i am using:
<script>var directorDate = new Date(<?php $date = get_option('director_date');?>
<?php if( $date) : ?>
<?php echo $date; ?>
<?php endif; ?>);
var directorCity = <?php $city = get_option('director_city');?>
<?php if( $city) : ?>
<?php echo $city; ?>
<?php endif; ?></script>
Basically what is happening is that the header gets the data from a file themeoptions.php (A form in the wordpress admin for a user to input data.I have not shown it because the structure of both director_city and director_date is the same there) and then custom.js gets the data from the header.
Now the countdown runs however the city is not displayed. Why is that so?