Wednesday, November 26, 2014

YII Add Loading IMAGE on ajex

Standard



beginWidget('CActiveForm', array(
                                        'id'=>'listings-getdata_Ajax',                                    
                                        'enableAjaxValidation'=>FALSE,
                                )); ?>
             
                   params['Radius'],
                             array(
                               'ajax'=>array(
                                 'type'=>'POST',
                                  'url'=>CController::createUrl('listings/getdata_Ajax'),                            
                                    'update'=>'#getdata',
                                   'data' => array(
                                        'Getdata[radius]'=>'js:this.value',
                                        'Getdata[city]'=>$model->PhysicalCity,
                                             )
                                     ),
                                    'class'=>'form-control input-sm',
                                     'empty'=>'Select Province',
                                    'required'=>TRUE,
                                     )
                                    );
                        ?>
                        clientScript->registerScript('loaderScript', '
                             $("#loader")
                             .hide()
                             .ajaxStart(function() {
                                 $(this).show();
                             })
                             .ajaxStop(function() {
                                 $(this).hide();
                             });', CClientScript::POS_END);
                         ?>

                    theme->baseUrl.'/images/loader.gif', '', array('id' => 'loader', 'style' => ''));?>
             


 public function actionGetdata_Ajax()
             
 {
      echo 'hello';
        }
             

      

0 comments:

Post a Comment