javascript - How to create Stop watch -


i have ajax call. this:

$(document).on('submit', '#formpropiedades', function(event) {     event.preventdefault();     var content = {}, url = "http://www.xxxxyzzz.com/xxx/yyy/web/ajax.php";         $("#dialog1").dialog("open");     var posting = $.post(url, {         im_core: 'savealladds',         idfeed: <?php echo $_post['idfeed'] ?>,         pais: <?php echo $pais1?>     }).done(function(data) {         if (data == 1)             $(".overlay-bg1").html("suces....");         else             $(".overlay-bg1").html(data);     });  <?php } ?>   }); 

and hhtml looks this:

<div id="dialog1" title="attention!!" style="width:60%">     <div class="overlay-bg1">saving adds....</div> </div> 

the code opening jquery ui dialogue

$(function () {     $("#dialog1").dialog({         autoopen: false,         show: {             effect: "blind",             duration: 1000         },         hide: {             effect: "",             duration: 1000         },       }); }); 

i want show timer in popup should start when ajax call done , stop when response. should stop watch

before ajax start:

var starttime = (new date()).gettime(); 

when response:

var nowtime = (new date()).gettime(); var thetime = nowtime - starttime; 

update:

with visual timer demo

update:

seconds , minutes demo

update:

with number round demo


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -