javascript - Make knob load after AJAX success -


i knob animated right after ajax call done. number, knob should progress without refresh. want is: ajax request succesfull -> sends number knob function -> knob fill up.

code:

..  success: function(data) {     knobload(data); }  ..  function knobload(data) {    $('.knob').each(function () {         var $this = $(this);        $this.knob({         });        $({            value: 0        }).animate({             value: data        }, {            duration: 2000,            easing: 'swing',            step: function () {                $this.val(math.ceil(this.value)).trigger('change');             }        })     }); } </script> <input class="knob animated" value="0" readonly data-width="80%"> 

ended adding knob inside file ajax requests, , display afterwards.

        $.ajax({                 url: 'ajax.php',                 data: {                     id: id                  },                 success: function(data) {                     $('#knob').html(data);                 }             }); 

the ajax file:

   $('.knob').each(function () {         var $this = $(this);        $this.knob({         });        $({            value: 0        }).animate({             value: data        }, {            duration: 2000,            easing: 'swing',            step: function () {                $this.val(math.ceil(this.value)).trigger('change');             }        })     }); </script> <input class="knob animated" value="0" readonly data-width="80%"> 

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -