Chtml::ajax() Doesn't Work

I need to check the user’s login and give some notice to the user if his password is wrong .etc.

I cannot use model to help do this because of some reasons.So I write the ajax myself. I do that like this.


   <form action = '<?php echo Yii::app()->createUrl('User/Login');?>' name = 'signup' method = 'POST'>

	Email <input type= 'text' id= 'email' name = 'email'><br>

	Password <input type= 'password' id= 'password' name= 'password'><br>

	<span id= 'error_info'></span> <!--display the error here -->

	<input type= 'submit' value='submit' onclick='checkValue()'>



   <script language= 'javascript'>

	function checkValue(){

		var email = document.getElementById('email').value;

		var password = document.getElementById('password').value;


			echo CHtml::ajax(


					"url" => CController::createUrl("User/Login"),

					"data" => "js:{email : email, password : password}",











   class UserController extends Controller


        public function actionLogin(){


		  echo 'test notice';






When I submit the form. The ‘test notice’ that should be in <span id=‘error_info’></span> appears at the upper left corner,and nothing has alerted. If I uncomment //‘error’=>“js:function(){alert(‘error’)}” in the view, it will alert error and disappear quickly,then the notice ‘test notice’ will appear at the upper left corner.

And if I write param success like this,it will alert ‘ok’.So there maybe something wrong when the client accept the response from controller.Where is the error?I cann’t find it myself.Is there some grammar error or something?


I have write the original ajax code that works fine without yii,however, it still doesn’t work in Yii.

   <script language = 'javascript'>

	function checkValue(){


    	        type: "POST",            

    	        url: "",   

    	        dataType: "text",  

    	        success: function(data){  







So I doubt if there is any problem with the yii jquery file,so I add the newest jquery file in the view,but it doesn’t work.

<script src=''></script>

Why and how to solve it?

Thank you for your patient to read that.Please help~~ Thank you very much!It have annoyed me serveral days.