纠结一下午了,求高手相助,刚接触yii,这有什么问题吗
$.ajax({
type:'post',
url:"/www/index.php?r=home/CkUser",//这个地址应该怎么写
data:{"name":val},
success:function(msg){
alert("正确");
$("#nameinfo").html(msg);
},
}
);
我想传值到actionCkUser()里
class HomeController extends Controller{
public function actionCkUser(){
//todo
$name=Yii::app()->request->getParam('name');
echo $name.'bb';
$model=new User;
if($name)
{
$model->username=$name;
$user = User::model() -> find("username = '{$this -> username}'");
$result='';
if($user)
{
$result='用户已存在';
}
else
{
$result='ok';
}
return $result;
}
$this->render('CkUser',array(
'model'=>$model));
}
}
yii Jquery?Ajax