内部服务器在yii中加载ajax时出错

时间:2012-12-02 09:06:36

标签: php yii

我在加载Ajax时遇到了问题,我知道通过screanshot的请求 篡改数据:

http://up.arabseyes.com/uploads/02_12_1213544389861.jpg

结果是:内部服务器错误。 我的代码有什么问题?

查看:

<?php
/* @var $this UsersController */
/* @var $model Users */
/* @var $form CActiveForm */
?>

<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
    'id'=>'users-index-form',
    'enableAjaxValidation'=>false,
)); ?>







    <?php echo $form->errorSummary($model); ?>

    <div class="row">
        <?php echo $form->labelEx($model,'الأسم الأول'); ?>
        <?php echo $form->textField($model,'first_name'); ?>
        <?php echo $form->error($model,'الأسم الاول'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model,'العائلة'); ?>
        <?php echo $form->textField($model,'last_name'); ?>
        <?php echo $form->error($model,'العائلة'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model,'كلمة المرور'); ?>
        <?php echo $form->passwordField($model,'password'); ?>
        <?php echo $form->error($model,'password'); ?>
    </div>
    <div class="row">
        <?php echo $form->labelEx($model,'تأكيد كلمة المرور'); ?>
        <?php echo $form->passwordField($model,'passwordconfirm'); ?>
        <?php echo $form->error($model,'passwordconfirm'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model,'البريد الإلكتروني '); ?>
        <?php echo $form->textField($model,'email'); ?>
        <?php echo $form->error($model,'email'); ?>
    </div>
        <div class="row">
        <?php echo $form->labelEx($model,'تأكيد البريد الإلكتروني'); ?>
        <?php echo $form->textField($model,'emailconfirm'); ?>
        <?php echo $form->error($model,'emailconfirm'); ?>
    </div>

        <div class="row">
        <?php echo $form->labelEx($model,'تاريخ الميلاد'); ?>
    <?php

$this->widget(
    'ext.jui.EJuiDateTimePicker',
    array(
        'model'     => $model,
        'attribute' => 'birth_date',
        'language'=> 'en',//default Yii::app()->language
         'mode'    => 'date',//'datetime' or 'time' ('datetime' default)
        'options'   => array(
        'dateFormat' => 'yy-mm-dd',
            //'timeFormat' => '',//'hh:mm tt' default
        ),
    )
);


?>

        <?php echo $form->error($model,'birth_date'); ?>
    </div>





    <div class="row">
        <?php echo $form->labelEx($model,'الجنس'); ?>
        <?php echo chtml::activeDropDownList($model,'gender',$model->getStatusOption(),array('prompt'=>'أختر جنسك')
); ?>
        <?php echo $form->error($model,'gender'); ?>
    </div>

        <div class="row">
        <?php echo $form->labelEx($model,'البلد'); ?>
    <?php

    /*
     echo chtml::activeDropDownList($model,'country',$model->getcountry(),array('prompt'=>'اختر بلدك ')   , 
    array(
'ajax' => array(
'type'=>'POST', //request type
'url'=>CController::createUrl('current/dynamiccities'), //url to call.
//Style: CController::createUrl('currentController/methodToCall')
'update'=>'#city', //selector to update
//'data'=>'js:javascript statement' 
//leave out the data key to pass all form values through
))

    ); 

    */
    echo CHtml::activedropDownList($model,'country',$model->getcountry(),

    array(
'ajax' => array(
'type'=>'POST', //request type
'url'=>CController::createUrl('Register/dynamiccities'), //url to call.
//Style: CController::createUrl('currentController/methodToCall')
'update'=>'#city', //selector to update
//'data'=>'js:javascript statement' 
//leave out the data key to pass all form values through
))
    );


    ?>


        <?php echo $form->error($model,'country'); ?>
    </div>
    <div class="row">
        <?php echo $form->labelEx($model,'المدينة'); ?>
        <?php 
       //empty since it will be filled by the other dropdown
echo CHtml::dropDownList('city','', array());
 ?>
        <?php echo $form->error($model,'city'); ?>
    </div>



    <div class="row">
        <?php echo $form->labelEx($model,'رمز الاتصال'); ?>
        <?php echo $form->textField($model,'mobile_code'); ?>
        <?php echo $form->error($model,'mobile_code'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model,'رقم الجوال'); ?>
        <?php echo $form->textField($model,'mobile_number'); ?>
        <?php echo $form->error($model,'mobile_number'); ?>
    </div>




    <div class="row buttons">
        <?php echo CHtml::submitButton('تسجيــــــــــــل'); ?>
    </div>

<?php $this->endWidget(); ?>

</div><!-- form -->

控制器:

....
public function actionDynamiccities() /// call Ajax
{

 $data=Cities::model()->findAll('country=:country_id', 
                  array(':country_id'=>(int) $_POST['country']));

    $data=CHtml::listData($data,'id','city_name_e');
    foreach($data as $value=>$name)
    {
        echo CHtml::tag('option',
                   array('value'=>$value),CHtml::encode($name),true);
    };

}  
   ....

先谢谢。

0 个答案:

没有答案