title: dropdown is not working i ajax form submit in yii 1x
body: <p>My drop down is not working in ajax form submit but its working on normal form.</p>
  
  <p>When i do ajax submit  i get error in firebug<br>
  "NetworkError: 404 Not Found -<code> <a href="http://example.com/yii/def/state/create" rel="nofollow">http://example.com/yii/def/state/create</a>" </code></p>
  
  <p>But when i do the normal submission the form works.
  Please help me to solve this issue
   My ajax view is _ajax_create_form.php. Code:</p>
  
  <pre><code>&lt;div class="form"&gt;
  &lt;?php
  $form=$this-&gt;beginWidget('bootstrap.widgets.TbActiveForm',array(
  'id'=&gt;'state-create-form',
  'enableAjaxValidation'=&gt;true,
      'enableClientValidation'=&gt;true,
      'method'=&gt;'post',
      'action'=&gt;array("state/create"),
  'type'=&gt;'horizontal',
  'htmlOptions'=&gt;array(
                          'onsubmit'=&gt;"return false;",/* Disable normal form submit */
                          ),
        'clientOptions'=&gt;array(
                  'validateOnType'=&gt;true,
                  'validateOnSubmit'=&gt;true,
                  'afterValidate'=&gt;'js:function(form, data, hasError) {
                                   if (!hasError)
                                      {    
                                        create();
                                      }
                                   }'
       ),                  
  
  )); ?&gt;
  
  div class="row"&gt; &lt;?php echo $form-&gt;labelEx($model,'country_id'); ?&gt; &lt;?php echo $form-&gt;dropDownList($model,'country_id',
                                                CHtml::listData(Country::model()-&gt;findAll(),'id','name')); ?&gt; &lt;?php echo $form-&gt;error($model,'country_id'); ?&gt; &lt;/div&gt;
  &lt;div class="modal-footer"&gt;
      &lt;div class="form-actions"&gt;
        &lt;?php
  
       $this-&gt;widget('bootstrap.widgets.TbButton', array(
          'buttonType'=&gt;'submit',
          'type'=&gt;'primary',
                      'icon'=&gt;'ok white', 
          'label'=&gt;$model-&gt;isNewRecord ? 'Create' : 'Save',
          ));
  ?&gt;
      &lt;/div&gt;
    &lt;/div&gt;
   &lt;?php
   $this-&gt;endWidget(); ?&gt;
    &lt;/div&gt;
  </code></pre>
  
  <p>Scipt for ajax submit</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  function create()
   {
  
     var data=$("#state-create-form").serialize();
  
  
  
    jQuery.ajax({
     type: 'POST',
      url: '&lt;?php
   echo Yii::app()-&gt;createAbsoluteUrl("state/create"); ?&gt;',
     data:data,
  success:function(data){
              //alert("succes:"+data); 
              if(data!="false")
               {
                $('#state-create-modal').modal('hide');
                renderView(data);
                  $.fn.yiiGridView.update('state-grid', {
  
                       });
  
               }
  
            },
     error: function(data) { // if error occured
       alert("Error occured.please try again");
       alert(data);
  },
  
    dataType:'html'
    });
  
  }
  
  function renderCreateForm()
  {
    $('#state-create-form').each (function(){
    this.reset();
     });
  
  
    $('#state-view-modal').modal('hide');
  
    $('#state-create-modal').modal({
     show:true,
  
    });
  }
  
  &lt;/script&gt; 
  </code></pre>
  
  <p>My Controller code is </p>
  
  <pre><code>public function actionCreate()
  {   
          $model=new State;
  
      // Uncomment the following line if AJAX validation is needed
  
      $this-&gt;performAjaxValidation($model,"state-create-form");
          if(Yii::app()-&gt;request-&gt;isAjaxRequest)
         {
              print_r($_POST['State']);
          if(isset($_POST['State']))
          {
              $model-&gt;attributes=$_POST['State'];
              if($model-&gt;save())
              {
                echo $model-&gt;id;
              }
              else
              {
                echo "false";
              } 
              return;
          }
         }
         else
         {
             if(isset($_POST['State']))
          {
              $model-&gt;attributes=$_POST['State'];
              if($model-&gt;save())
               $this-&gt;redirect(array('view','id'=&gt;$model-&gt;id));
  
          }
  
          $this-&gt;render('create',array(
              'model'=&gt;$model,
          ));
         }    
  }
  </code></pre>