title: How update only one div's content in Yii by ajax?
body: <p>I have a little problem about, when I try to update (refresh) my div's content, the Ajax replace the all page in that div.</p>
  
  <p>Here the problem: <a href="http://postimg.org/image/6px3usp1z/" rel="nofollow">Screenshoot of the problem</a></p>
  
  <p>Here is my controller source:<a href="http://postimg.org/image/sww8tcsvl/76d84398/" rel="nofollow">How should it looks</a></p>
  
  <pre><code>public function actionView() {
          //print_r($_POST);
          $model = null;
  
          if( "user" == Yii::app()-&gt;user-&gt;getState("user_type")){
              $model = new FormResultUser();
          }
          else if( "faction" == Yii::app()-&gt;user-&gt;getState("user_type")){
              $model = new FormResultFaction();
          }
  
          $index = 0;
          //echo $index;
          if( Yii::app()-&gt;request-&gt;isAjaxRequest){
              if(isset($_POST['index'])){
                  $index = CPropertyValue::ensureInteger( $_POST['index'] ) +1;
              }
          }
          //echo $index;
          $criteria = new CDbCriteria();
          $criteria-&gt;limit = "1";
          $criteria-&gt;offset = $index;
          $questionModel = Question::model()-&gt;find($criteria);
  
         // print_r($questionModel);
  
          if (Yii::app()-&gt;request-&gt;isAjaxRequest) {
              $this-&gt;render('_viewForm', array('model' =&gt; $model, 'questionModel'=&gt; $questionModel, 'index'=&gt;$index));
          } else {
              $this-&gt;render('viewForm', array('model' =&gt; $model, 'questionModel'=&gt; $questionModel, 'index'=&gt;$index));
          }       
      }
  </code></pre>
  
  <p>And my viewForm:
  Here you can see, the AjaxSubmitButton is here. and <code>&lt;div id="form"&gt;</code> is too, what I would like to update. ( and I would like to update the <code>$index</code> variable too in the ajaxSubmitButton)</p>
  
  <p>I tired the '<code>replace'</code> too, but it doesn't work well, the problem is the same.</p>
  
  <pre><code>&lt;?php /* FormFilling */ ?&gt;
  &lt;div id="form"&gt;
      &lt;?php $form=$this-&gt;beginWidget('CActiveForm'); ?&gt;
  
      &lt;?php
      $this-&gt;renderPartial('_viewForm', array('model' =&gt; $model, 'questionModel'=&gt; $questionModel, 'index'=&gt;$index, 'form'=&gt;$form));
      ?&gt;
      &lt;div class="row margin10"&gt;
  
      &lt;?php
      echo CHtml::ajaxSubmitButton(Yii::t('strings', 'Next'), Yii::app()-&gt;createUrl('formFilling/view'), array(
              'type' =&gt; 'post',
              'data' =&gt; array("index" =&gt; $index),
              'update' =&gt; '#form',
          ));
      ?&gt;
      &lt;/div&gt;
      &lt;?php $this-&gt;endWidget(); ?&gt;
  &lt;/div&gt;&lt;!-- end form --&gt;
  &lt;?php
  </code></pre>
  
  <p>At finally my _viewForm:</p>
  
  <pre><code>&lt;?php
  $answers = CHtml::listData(Answer::model()-&gt;findAll(), 'value', 'label');
  ?&gt;
  &lt;div id="formAnswer" class="row"&gt;&lt;/div&gt;
  &lt;div class="row text"&gt;
      &lt;p&gt;
          &lt;?php echo CHtml::encode($questionModel-&gt;text); ?&gt;  
      &lt;/p&gt;        
  &lt;/div&gt;
  &lt;div class="row margin10"&gt;
      &lt;span&gt;
          &lt;?php echo CHtml::encode(Yii::t('strings', 'Answer options'), ''); ?&gt;
      &lt;/span&gt;
      &lt;div class="margin10"&gt;
          &lt;?php
          echo CHtml::activeRadioButtonList($model, 'answer_value', $answers, array("class" =&gt; "left"));
          ?&gt;   
      &lt;/div&gt;    
  &lt;/div&gt;
  &lt;div class="row margin10"&gt;
      &lt;span&gt;
          &lt;?php echo CHtml::label(Yii::t('strings', 'Significant topic'), 'ch_answer_important'); ?&gt;
      &lt;/span&gt;
  
      &lt;?php
          echo CHtml::activeCheckBox( $model,
                                      'answer_important',
                                      array("id" =&gt; "ch_answer_important", "class" =&gt; "left"));
      ?&gt;   
  
  &lt;/div&gt;
  &lt;?php //echo CHtml::hiddenField('index', $index) ?&gt;
  </code></pre>