Countdown & interval based example

 

var countdown = $(“#countdown”).countdown360({
radius : 100,
seconds : 120,
fontColor : ‘#FFFFFF’,
autostart : false,
onComplete : function () { console.log(‘done’) }
});
countdown.start();

$(document).on(“click”,”button”,function(e){
e.preventDefault();
var type = $(this).attr(“data-type”);
if(type === “time-remaining”)
{
var timeRemaining = countdown.getTimeRemaining();
alert(timeRemaining);
}
else
{
var timeElapsed = countdown.getElapsedTime();
alert(timeElapsed);
}
});

$(function() {
var nre = setInterval(checkit, 5000);
function checkit(){
$.ajax({
url: ‘url’,
dataType: ‘json’,
cache: true,
timeout: 300000,
success: function(data) {

// $(‘#output ul’).append(‘<li>The feed loads fine’);
$.each(data, function(i,datas){
if(datas.status==”Pending”)
{
$(‘#output’).append(“….”);
}
else
{

$(‘#output’).html(“Your Order Accepted and you are going to recived it within “+datas.comment);
clearInterval(nre);
}

});

},
error: function(){
$(‘#output ul’).append(‘<li>Error’);
}
});

}
});

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s