I need to create a countdown script that reads the due date from an XML file,
The XML FILE:
<?xml version="1.0" ?>
<Imskia ID="Ramadan2012">
<day date="2012, 7 - 1, 23">
<Fagr>3:26</Fagr>
<Shrok>5:22</Shrok>
<Dohr>12:02</Dohr>
<Asr>3:38</Asr>
<Maghrb>6:57</Maghrb>
<Ishaa>8:27</Ishaa>
</day>
<day date="2012, 7 - 1, 24">
<Fagr>3:26</Fagr>
<Shrok>5:22</Shrok>
<Dohr>12:02</Dohr>
<Asr>3:38</Asr>
<Maghrb>6:59</Maghrb>
<Ishaa>8:27</Ishaa>
</day>
</Imskia>
and here the Javascipt in the HTML file:
$(document).ready(function(){
$.get('test.xml', function(d){
$(d).find('day').each(function(){
var $day = $(this);
var date = $day.attr("date");
var Maghrb = $day.find('Maghrb').text();
$('body').append($(html));
//countdown
$('#defaultCountdown').countdown({
until: new Date(date), timezone: +2
});
});
});
});
the problem was that the countdown script doesn't read the variable stores the Date from the XML file, but it works fine when put it manually as below:
//countdown
$('#defaultCountdown').countdown({
until: new Date(2012, 7 - 1, 24), timezone: +2
});