javascript - Passing function response (callback) as variable to another function -


see below. i'm trying pass function(response) variable used in progress bar function. that's idea anyways. how call data = response var = data in case?

$(document).ready(function () {     $.ajaxsetup({         cache: false     });     var data = 0;     setinterval(function () {         $('#divtorefresh').load('usercounter.php', function (response) {             data = response;         });     }, 100);     window.onload = function () {         var animator = new function () {                 var parent = document.getelementbyid('container');                 var element = document.getelementbyid('test');                 var target = document.getelementbyid('message');                 this.move = function () {                     var = data;                     var width = 0;                     var timer = window.settimeout(function () {                         += 1;                         element.style.width = width + + 'px';                     }, 10);                 };             };         animator.move();     }; }); 

not sure how animator works or how elements interact, i'm guessing goal call move periodically refresh it's current status? put in interval, , make retrieval of count part of animation. not sure if that'll work scenario.

$(document).ready(function () {     $.ajaxsetup({         cache: false     });        window.onload = function () {         var animator = new function () {                 var parent = document.getelementbyid('container');                 var element = document.getelementbyid('test');                 var target = document.getelementbyid('message');                 this.move = function () {                     $('#divtorefresh').load('usercounter.php', function (response) {                         var = response;                                               var width = 0;                         var timer = window.settimeout(function () {                           += 1;                           element.style.width = width + + 'px';                         }, 10);                     });                  };             };         animator.move();         setinterval(function () {            animator.move();         }, 100);     }; }); 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -