简体   繁体   中英

Passing additional parameters to callback function in Extjs 4.2.0

I have a handler funciton attached to a button which makes an ajax call and acts based on success and failure. on success, it calls another function with default response parameter. How can we pass an additional parameter along with the server response json object. Below is the code example.

    buttonClick: function(button,e,eOpts){
    makeAjaxCall(
    null,
    url,
    {
     scope:this,
     fn: this.onSubmit// want to pass additional custom parameter to this function.
    }
    )
    }
    // function d
    onSubmit: function(response) {
    var object = Ext.JSON.decode(response.responseText)

    }

based upon the additional parameter i will decide the functionality, as this function onSubmit() is called by two different button clicks.Please help

You could add another parameter to your function, and then create a new function by passing a value.

fn: this.onSubmit.pass('type1')

onSubmit: function(type, response) {

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM