1. #1
    Sencha User
    Join Date
    Jun 2011
    Location
    Bangalore, India
    Posts
    175
    Answers
    4
    Vote Rating
    2
    renganathan is on a distinguished road

      0  

    Default Answered: How to make ajax call for every 5 seconds?

    Answered: How to make ajax call for every 5 seconds?


    Hi All,

    I want to make ajax call for every 5 seconds.

    Can you guys suggest me how to do that ?
    Thanks,

    RENGANATHAN M G

  2. You could use Ext.util.DelayedTask

    Example

    Code:
            this.pollTask = new Ext.util.DelayedTask(function(){
                Ext.Ajax.request({
                    url: pollUrl,
                    scope: this,
                    success: function(r) {
                    },
                    failure: function() {
                    }
                });
                this.pollTask.delay(5000);
            }, this);
    
    
            this.pollTask.delay(5000);

  3. #2
    Sencha User wojteks27's Avatar
    Join Date
    Aug 2011
    Location
    Kraków, Poland
    Posts
    30
    Answers
    3
    Vote Rating
    2
    wojteks27 is on a distinguished road

      0  

    Default Interval

    Interval


    Use this :
    Code:
    //we store setInterval's return value in case we want to clear the interval later on with clearInterval(myInterval)
    var myInterval = setInterval(function() {
    //here you put your AJAX request
    }, 5000//5 seconds in ms);
    PS.
    of course if it is what you were looking for and I understood you correctly

  4. #3
    Sencha Premium Member
    Join Date
    Feb 2010
    Location
    Chicago
    Posts
    34
    Answers
    10
    Vote Rating
    8
    Johnny Major will become famous soon enough

      0  

    Default


    You could use Ext.util.DelayedTask

    Example

    Code:
            this.pollTask = new Ext.util.DelayedTask(function(){
                Ext.Ajax.request({
                    url: pollUrl,
                    scope: this,
                    success: function(r) {
                    },
                    failure: function() {
                    }
                });
                this.pollTask.delay(5000);
            }, this);
    
    
            this.pollTask.delay(5000);

  5. #4
    Sencha User wojteks27's Avatar
    Join Date
    Aug 2011
    Location
    Kraków, Poland
    Posts
    30
    Answers
    3
    Vote Rating
    2
    wojteks27 is on a distinguished road

      0  

    Default Ext.TaskManager

    Ext.TaskManager


    According to Sencha docs here : http://docs.sencha.com/core/manual/content/timers.html, the correct way would be to use Ext.TaskManager.

    Still I wonder why is it advised to use this solution instead of basic setInterval.
    Can anyone explain?

  6. #5
    Sencha User
    Join Date
    Jun 2011
    Location
    Bangalore, India
    Posts
    175
    Answers
    4
    Vote Rating
    2
    renganathan is on a distinguished road

      0  

    Default


    Thanks All for your solution
    Thanks,

    RENGANATHAN M G

Thread Participants: 2

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi