Confirm Dialog onOk listener-handler

I have the following link :




return Html::a(FA::icon('flag-checkered'),['action', 'id' => $model->id],

                                                         ['title' => Yii::t('app', 'title'),

                                                          'data' => [

                                                                      'method' => 'post',

                                                                      'confirm' => 'Are you sure ?',

                                                                    ],

                                          ]);



Which will show a confirmation dialog with an "OK" and a "cancel" buttons.

how can I handle the OK pressed and the Cancel Pressed event of this confirm dialog ?

I need something like this :




 'data' => [

'method' => 'post',

'confirm' => 'Are you sure ?',

'onConfirm'=>'$("#loader").show()'],