Social Icons

Pages

Monday, March 25, 2013

Ajax button with confirm and before send texts


In View

<?php
echo "<div id='resPass'>";
echo CHtml::ajaxButton(
'Reset Password',          // the link body (it will NOT be HTML-encoded.)
array('resetPassword','id'=>$model->user_id), // the URL for the AJAX request. If empty, it is assumed to be the current URL.
array(
'update'=>'#req_res_loading',
'beforeSend' => 'function() {   
     
 $("#resPass").html("please wait......");

     }',

     'complete' => 'function() {
      $("#resPass").hide();
     }', 
),

      array(
   'class'=>'btn btn-info',
   'confirm'=>Yii::t('admin','Are you want to Reset Password ?'),
      )


);
echo "</div>"
?>
<div id="req_res_loading"></div>


In controller 


       public function actionResetPassword($id)
{
        if(Yii::app()->request->isAjaxRequest)
                {
       .................
              Yii::app()->end();
        }
   
}



No comments:

Post a Comment