title: internal server Error when load ajax in yii
body: <p>I had problem in loading Ajax , I knew that by got screanshot of request by 
  Tamper Data :</p>
  
  <p><a href="http://up.arabseyes.com/uploads/02_12_1213544389861.jpg" rel="nofollow">http://up.arabseyes.com/uploads/02_12_1213544389861.jpg</a></p>
  
  <p>result was : internal server Error . 
  What is the problem in my code ?</p>
  
  <p>View :</p>
  
  <pre><code>&lt;?php
  /* @var $this UsersController */
  /* @var $model Users */
  /* @var $form CActiveForm */
  ?&gt;
  
  &lt;div class="form"&gt;
  
  &lt;?php $form=$this-&gt;beginWidget('CActiveForm', array(
      'id'=&gt;'users-index-form',
      'enableAjaxValidation'=&gt;false,
  )); ?&gt;
  
  
  
  
  
  
  
      &lt;?php echo $form-&gt;errorSummary($model); ?&gt;
  
      &lt;div class="row"&gt;
          &lt;?php echo $form-&gt;labelEx($model,'الأسم الأول'); ?&gt;
          &lt;?php echo $form-&gt;textField($model,'first_name'); ?&gt;
          &lt;?php echo $form-&gt;error($model,'الأسم الاول'); ?&gt;
      &lt;/div&gt;
  
      &lt;div class="row"&gt;
          &lt;?php echo $form-&gt;labelEx($model,'العائلة'); ?&gt;
          &lt;?php echo $form-&gt;textField($model,'last_name'); ?&gt;
          &lt;?php echo $form-&gt;error($model,'العائلة'); ?&gt;
      &lt;/div&gt;
  
      &lt;div class="row"&gt;
          &lt;?php echo $form-&gt;labelEx($model,'كلمة المرور'); ?&gt;
          &lt;?php echo $form-&gt;passwordField($model,'password'); ?&gt;
          &lt;?php echo $form-&gt;error($model,'password'); ?&gt;
      &lt;/div&gt;
      &lt;div class="row"&gt;
          &lt;?php echo $form-&gt;labelEx($model,'تأكيد كلمة المرور'); ?&gt;
          &lt;?php echo $form-&gt;passwordField($model,'passwordconfirm'); ?&gt;
          &lt;?php echo $form-&gt;error($model,'passwordconfirm'); ?&gt;
      &lt;/div&gt;
  
      &lt;div class="row"&gt;
          &lt;?php echo $form-&gt;labelEx($model,'البريد الإلكتروني '); ?&gt;
          &lt;?php echo $form-&gt;textField($model,'email'); ?&gt;
          &lt;?php echo $form-&gt;error($model,'email'); ?&gt;
      &lt;/div&gt;
          &lt;div class="row"&gt;
          &lt;?php echo $form-&gt;labelEx($model,'تأكيد البريد الإلكتروني'); ?&gt;
          &lt;?php echo $form-&gt;textField($model,'emailconfirm'); ?&gt;
          &lt;?php echo $form-&gt;error($model,'emailconfirm'); ?&gt;
      &lt;/div&gt;
  
          &lt;div class="row"&gt;
          &lt;?php echo $form-&gt;labelEx($model,'تاريخ الميلاد'); ?&gt;
      &lt;?php
  
  $this-&gt;widget(
      'ext.jui.EJuiDateTimePicker',
      array(
          'model'     =&gt; $model,
          'attribute' =&gt; 'birth_date',
          'language'=&gt; 'en',//default Yii::app()-&gt;language
           'mode'    =&gt; 'date',//'datetime' or 'time' ('datetime' default)
          'options'   =&gt; array(
          'dateFormat' =&gt; 'yy-mm-dd',
              //'timeFormat' =&gt; '',//'hh:mm tt' default
          ),
      )
  );
  
  
  ?&gt;
  
          &lt;?php echo $form-&gt;error($model,'birth_date'); ?&gt;
      &lt;/div&gt;
  
  
  
  
  
      &lt;div class="row"&gt;
          &lt;?php echo $form-&gt;labelEx($model,'الجنس'); ?&gt;
          &lt;?php echo chtml::activeDropDownList($model,'gender',$model-&gt;getStatusOption(),array('prompt'=&gt;'أختر جنسك')
  ); ?&gt;
          &lt;?php echo $form-&gt;error($model,'gender'); ?&gt;
      &lt;/div&gt;
  
          &lt;div class="row"&gt;
          &lt;?php echo $form-&gt;labelEx($model,'البلد'); ?&gt;
      &lt;?php
  
      /*
       echo chtml::activeDropDownList($model,'country',$model-&gt;getcountry(),array('prompt'=&gt;'اختر بلدك ')   , 
      array(
  'ajax' =&gt; array(
  'type'=&gt;'POST', //request type
  'url'=&gt;CController::createUrl('current/dynamiccities'), //url to call.
  //Style: CController::createUrl('currentController/methodToCall')
  'update'=&gt;'#city', //selector to update
  //'data'=&gt;'js:javascript statement' 
  //leave out the data key to pass all form values through
  ))
  
      ); 
  
      */
      echo CHtml::activedropDownList($model,'country',$model-&gt;getcountry(),
  
      array(
  'ajax' =&gt; array(
  'type'=&gt;'POST', //request type
  'url'=&gt;CController::createUrl('Register/dynamiccities'), //url to call.
  //Style: CController::createUrl('currentController/methodToCall')
  'update'=&gt;'#city', //selector to update
  //'data'=&gt;'js:javascript statement' 
  //leave out the data key to pass all form values through
  ))
      );
  
  
      ?&gt;
  
  
          &lt;?php echo $form-&gt;error($model,'country'); ?&gt;
      &lt;/div&gt;
      &lt;div class="row"&gt;
          &lt;?php echo $form-&gt;labelEx($model,'المدينة'); ?&gt;
          &lt;?php 
         //empty since it will be filled by the other dropdown
  echo CHtml::dropDownList('city','', array());
   ?&gt;
          &lt;?php echo $form-&gt;error($model,'city'); ?&gt;
      &lt;/div&gt;
  
  
  
      &lt;div class="row"&gt;
          &lt;?php echo $form-&gt;labelEx($model,'رمز الاتصال'); ?&gt;
          &lt;?php echo $form-&gt;textField($model,'mobile_code'); ?&gt;
          &lt;?php echo $form-&gt;error($model,'mobile_code'); ?&gt;
      &lt;/div&gt;
  
      &lt;div class="row"&gt;
          &lt;?php echo $form-&gt;labelEx($model,'رقم الجوال'); ?&gt;
          &lt;?php echo $form-&gt;textField($model,'mobile_number'); ?&gt;
          &lt;?php echo $form-&gt;error($model,'mobile_number'); ?&gt;
      &lt;/div&gt;
  
  
  
  
      &lt;div class="row buttons"&gt;
          &lt;?php echo CHtml::submitButton('تسجيــــــــــــل'); ?&gt;
      &lt;/div&gt;
  
  &lt;?php $this-&gt;endWidget(); ?&gt;
  
  &lt;/div&gt;&lt;!-- form --&gt;
  </code></pre>
  
  <p>Controller :</p>
  
  <pre><code>....
  public function actionDynamiccities() /// call Ajax
  {
  
   $data=Cities::model()-&gt;findAll('country=:country_id', 
                    array(':country_id'=&gt;(int) $_POST['country']));
  
      $data=CHtml::listData($data,'id','city_name_e');
      foreach($data as $value=&gt;$name)
      {
          echo CHtml::tag('option',
                     array('value'=&gt;$value),CHtml::encode($name),true);
      };
  
  }  
     ....
  </code></pre>
  
  <p>Thanks in Advance . </p>