1. #1
    Sencha User
    Join Date
    Mar 2007
    Posts
    580
    Vote Rating
    0
    dolittle is an unknown quantity at this point

      0  

    Default passing arguments to failure callback on ajax call

    Hi,

    I want to pass the connection object itself as an additional argument to the failure callback.
    I`ve tried this:
    Code:
    con.request({
        xmlData: xmlMessage, 
        failure: function(responce, options, myArg){
             alert(myArg);
        }
    });
    But it says that myArg is undefined.
    How can I do it?

    Thanks

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

      0  

    Default

    Check out the createDelegate docs. It provides what you want.

    Code:
    con.request({
        xmlData: xmlMessage, 
        failure: function(responce, options){
             console.log(this); //this == con
        }.createDelegate(con)
    });
    or..
    Code:
    con.request({
        xmlData: xmlMessage, 
        failure: function(responce, options, connection){
             console.log([this,connection]); //this == connection == con
        }.createDelegate(con,[con],true)      //append to end of arguments
    });
    "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.


  3. #3
    Sencha User
    Join Date
    Mar 2007
    Posts
    580
    Vote Rating
    0
    dolittle is an unknown quantity at this point

      0  

    Default

    I`ll try it.
    Thanks

Thread Participants: 1