Gelmiş geçmiş en büyük porno sitemiz olan 2pe de her zaman en kaliteli pornoları sunmayı hedefledik. Diğer video sitemiz olan vuam da ise hd porno ağırlıklı çalışmalara başladık.

  1. #1
    Sencha Premium Member
    Join Date
    Jul 2009
    Location
    Poland
    Posts
    10
    Vote Rating
    0
    stricte is on a distinguished road

      0  

    Default Ajax.request factory

    Ajax.request factory


    Hi,

    i need help with my code. I want to build a Ajax.request factory, so:

    Code:
    MyApp.ajax_request = function(config){
    
       successfn = function(result, request){
           jsonData = Ext.util.JSON.decode(result.responseText);
           if(jsonData.success === true){
               config.successfn; //important. here i want to run function passed in config.
           }
           else{
             if(jsonData.error == 'TIMEOUT'){
                 Ext.Msg.show({
                     title: 'Błąd - ' + jsonData.error,
                     msg: jsonData.msg,
                     buttons: Ext.MessageBox.OK,
                     fn: function(){ window.location = '/' }
                 });
             }
             else if(jsonData.error == 'NOT_LOGGED'){
                 Ext.Msg.show({
                     title: 'Błąd - ' + jsonData.error,
                     msg: jsonData.msg,
                     buttons: Ext.MessageBox.OK,
                     fn: function(){ window.location = '/' }
                 });
             }
             else{
                 Ext.Msg.alert('Błąd - ' + jsonData.error, jsonData.msg);
             }
           }
       }
    
      failurefn = function(result, request){
           Ext.Msg.alert('error', 'error msg');
       }
    
    
      Ext.Ajax.request({
          url: config.url,
          params: config.params,
          success: successfn,
          failure: failurefn
      });
    }
    As I mentioned, I want to pass in config function which will be fired in success callback:

    Code:
    config = {
                   url: '/operators/new',
                   successfn: function(){
                      //some code to run, but never will. why?
                   },
                   params: {data: Ext.encode(nops)}
                 };
    MyApp.ajax_request(config);
    My question is how to pass function which will be trigered as is in my Ajax.request?
    -->

  2. #2
    Sencha - Community Support Team hendricd's Avatar
    Join Date
    Aug 2007
    Location
    Long Island, NY USA
    Posts
    5,962
    Vote Rating
    10
    hendricd will become famous soon enough hendricd will become famous soon enough

      0  

    Default Just do it!

    Just do it!


    Code:
     if(jsonData && jsonData.success === true){
          if(Ext.isFunction( config.successfn )){
              config.successfn(jsonData); //important. here i want to run function passed in config.
         }
     }
    "be dom-ready..."
    Doug Hendricks

    Maintaining ux: ManagedIFrame, MIF2 (FAQ, Wiki), ux.Media/Flash, AudioEvents, ux.Chart[Fusion,OFC,amChart], ext-basex.js/$JIT, Documentation Site.


    Got Sencha licensing questions? Find out more here.

    -->

Thread Participants: 1