title: Yii dropdown with AJAX not working as expected
body: <p>I have the following view named <code>'findreseller.php'</code>:</p>
  
  <pre><code>&lt;?php
  
  $countries = CHtml::listData(Country::model()-&gt;findAll(), 'id', 'name');
  
  echo CHtml::dropdownlist('find_reseller', '', $countries,
      array('ajax'=&gt;array(
              'type'=&gt;'POST',
              'url'=&gt;Yii::app()-&gt;getController()-&gt;createAbsoluteUrl('/webcare/reseller/loadAjaxData'),
              'update' =&gt;'#data',
              )
           )
      );
  
  ?&gt;
  &lt;div id="data"&gt;
     &lt;?php $this-&gt;renderPartial('_ajaxContent', array('dataProvider'=&gt;$dataProvider))?&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>_ajaxContent just echoes the result, nothing special there...
  The dropdown, as you can see is generated with CHtml because I dont't need a form. I just need an onChange event to do something...</p>
  
  <p>As per the code that follows, in <code>'/webcare/reseller/loadAjaxData'</code> I have:</p>
  
  <pre><code>public function actionLoadAjaxData() {
      $country = $_POST['find_reseller'];
      //do something...
      $dataProvider=new CArrayDataProvider($country_reseller);
  
      $this-&gt;render('findreseller', array('dataProvider' =&gt; $dataProvider));
  }
  </code></pre>
  
  <p>I can tell that I am missing something, but I am not sure what exactly.</p>
  
  <h2>Edit</h2>
  
  <p>Modified like this:</p>
  
  <pre><code> &lt;?php
   //CHtml::form();
   $countries = CHtml::listData(Country::model()-&gt;findAll(), 'id', 'name');
  
   echo CHtml::dropdownlist('find_reseller', '', $countries,
      array(
          'ajax' =&gt; array(
              'type'=&gt;'POST', //request type
              'url'=&gt;CController::createUrl('/webcare/reseller/loadAjaxData'), //url to call.
              //Style: CController::createUrl('currentController/methodToCall')
              'update'=&gt;'#city_id', //selector to update
              'data'=&gt;'js: $(this).val()', 
              //leave out the data key to pass all form values through
          )
      )
   ); 
  
   //empty since it will be filled by the other dropdown
   echo CHtml::dropDownList('city_id','', array());
   //CHtml::endForm();
   ?&gt;
   &lt;div id="data"&gt;
      &lt;?php $this-&gt;renderPartial('_ajaxContent', array('dataProvider'=&gt;$dataProvider))?&gt;
   &lt;/div&gt;
  </code></pre>
  
  <p>And now I get:</p>
  
  <p><a href="http://prntscr.com/42wwx6" rel="nofollow noreferrer">http://prntscr.com/42wwx6</a></p>
  
  <p>And I have the following controller action:</p>
  
  <pre><code> public function actionLoadAjaxData() {
      $country = $_POST['country_id'];
      ...
      $dataProvider=new CArrayDataProvider($country_reseller);
  
      $data = User::model()-&gt;findAll('country_id=:country_id AND reseller=:reseller', 
                array(':country_id'=&gt;(int) $_POST['country_id'], ':reseller'=&gt;1));
  
      $data=CHtml::listData($data,'city','city');
      foreach($data as $value=&gt;$name)
      {
          echo CHtml::tag('option',
                     array('value'=&gt;$value),CHtml::encode($name),true);
      }
  
      $this-&gt;render('action_name', array('dataProvider' =&gt; $dataProvider));
  }
  </code></pre>
  
  <h2>Edit 2</h2>
  
  <p>If I write a die in actionLoadAjaxData(), right at the beginning, the method is loaded fine, the action is ok and the server answers 200.</p>