[removed] Passing parameters to a callback function

后端 未结 13 2469
隐瞒了意图╮
隐瞒了意图╮ 2020-11-22 15:48

I\'m trying to pass some parameter to a function used as callback, how can I do that?

function tryMe (param1, param2) {
    alert (param1 + \" and \" + param         


        
13条回答
  •  甜味超标
    2020-11-22 16:34

    //Suppose function not taking any parameter means just add the GetAlterConfirmation(function(result) {});
    GetAlterConfirmation('test','messageText',function(result) {
                            alert(result);
        }); //Function into document load or any other click event.
    
    
    function GetAlterConfirmation(titleText, messageText, _callback){
             bootbox.confirm({
                        title: titleText,
                        message: messageText,
                        buttons: {
                            cancel: {
                                label: ' Cancel'
                            },
                            confirm: {
                                label: ' Confirm'
                            }
                        },
                        callback: function (result) {
                            return _callback(result); 
                        }
                    });
    

提交回复
热议问题