1. #1
    Ext JS Premium Member
    Join Date
    Sep 2010
    Posts
    11
    Vote Rating
    0
    chaudhry1 is on a distinguished road

      0  

    Default delay ajax request

    delay ajax request


    I want to delay my ajax requst, for testing, how can i do that...........like wait 15 sec and then send request

  2. #2
    Sencha User
    Join Date
    Aug 2009
    Posts
    480
    Vote Rating
    1
    plalx has a spectacular aura about plalx has a spectacular aura about

      0  

    Default


    To delay the request call, you can use Function.defer().

    E.g.

    Code:
     
    Ext.Ajax.request.defer(/*milliseconds*/, /*scope*/, [/*arguments*/]);

  3. #3
    Ext JS Premium Member
    Join Date
    Sep 2010
    Posts
    11
    Vote Rating
    0
    chaudhry1 is on a distinguished road

      0  

    Default


    I m totally new so please dont mind.
    HTML Code:
    myCall = Ext.Ajax.request({
                //will this work 
               Ext.Ajax.defer(1000);
     
    });
    so where i will put the delay as i was thinking more like this
    HTML Code:
    myCall = Ext.Ajax.request({
                //will this work 
              addListener: {
                          delay: 1000
     
     } ,
     
    });

  4. #4
    Sencha User
    Join Date
    Aug 2009
    Posts
    480
    Vote Rating
    1
    plalx has a spectacular aura about plalx has a spectacular aura about

      0  

    Default


    Do you want to delay the call or the return of the function?

  5. #5
    Ext JS Premium Member
    Join Date
    Sep 2010
    Posts
    11
    Vote Rating
    0
    chaudhry1 is on a distinguished road

      0  

    Default


    return of the function - thats what i want to try first

  6. #6
    Sencha User
    Join Date
    Aug 2009
    Posts
    480
    Vote Rating
    1
    plalx has a spectacular aura about plalx has a spectacular aura about

      0  

    Default


    You can do it this way:

    Code:
     
    Ext.onReady(function() {
     
      var onFailure = function() {
       console.log('request failed');
       console.log(arguments);
      };
      
      Ext.Ajax.request({
       url: 'wrongUrl.php',
       failure: function() {
        //Wait 5sec before doing anything
        onFailure.defer(5000, this, arguments); 
       }
      });
     });

Similar Threads

  1. add a param to all Ext.Ajax.request (tree, store, normal Ajax.request)
    By aj3423 in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 26 Jan 2010, 9:18 AM
  2. Delay AJAX processing in textfield
    By amc709 in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 13 Aug 2009, 6:57 AM
  3. autoLoad vs Ext.Ajax.request... loadScripts not working w/Ajax.request
    By zhegwood in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 6 Aug 2009, 3:28 PM
  4. Delay Ajax request before moving on..
    By rballman in forum Ext 2.x: Help & Discussion
    Replies: 7
    Last Post: 12 Feb 2008, 12:15 PM

Thread Participants: 1