English 中文(简体)
What are the steps to create AJAX login in yiiframework?
原标题:

I just started learning AJAX and Yiiframework. What are the steps to create AJAX login form in Yii?

Thank you.

最佳回答

Try the following in your view, where the login button is

<?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 is the ID of the DIV where you need to load in your message, EG. Successfully logged-in

Then in your controller the create method have something like this

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

Hope this helps

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

For the sake of real clarity (as not too many folks are using this framework quite yet) the above should be

$this->renderPartial




相关问题
ajax login using httpRequest?

I am trying to develop my login script to give feedback to the user if the login is valid or not. Basically if it isn t correct a div box will show saying its wrong, if its correct it will show its ...

Remotely authenticating client Windows user on demand

Suppose I am writing a server for a particular network protocol. If I know that the client is running on a Windows machine, is it possible for my server to authenticate the Windows user that owns the ...

Role/Permission based forms authorizing/authentication?

While looking into forms authorizing/authentication, I found that it is possible to do role based authorizing by adding an array of roles to a FormsAuthenticationTicket. That way I can write User....

热门标签