我刚开始学习AJAX和Yiiframework。什么是创造的Yii AJAX登录表单的步骤是什么?

感谢您。

有帮助吗?

解决方案

尝试以下在您的视图,其中该登录按钮是

<?php echo CHtml::ajaxButton('Add Course', array('student_Courses/Create'),array(
        'type'=>'POST',
        'update'=>'#resultStudentCourse',
        'beforeSend' => 'function(){
            $("#resultStudentCourse").addClass("loading");
        }',
        'complete' => 'function(){
            $("#resultStudentCourse").removeClass("loading");
            }',

)); ?>

#resultStudentCourse是在需要负荷在您的消息,EG的DIV的ID。成功登录

然后在控制器的创建方法有这样的事

if(Yii::app()->request->isAjaxRequest){
$this->renderPatial('create',array('model'=>$model));
}

希望这有助于

其他提示

    if(Yii::app()->request->isAjaxRequest){
$this->renderPatial('create',array('model'=>$model));
}

有关真实清楚起见(如没有太多的人使用此框架相当尚未)上述应

$this->renderPartial
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top