ThinkAjax返回数据出错???

浏览:761 发布日期:2013/10/20 分类:求助交流
今天我试试thinkajax,发现如下图的错误
index模板:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>ThinkAjax的使用</title>
<load href="__PUBLIC__/js/Base.js" />
<load href="__PUBLIC__/js/prototype.js" />
<load href="__PUBLIC__/js/mootools.js" />
<load href="__PUBLIC__/js/Ajax/ThinkAjax.js" />
<script language="JavaScript">
<!--

function add(){
    ThinkAjax.sendForm('form','__URL__/add',complete,'result');
}

function complete(data,status){
    if (status==1)
    {
    // 提示信息
    $('list').innerHTML = '<span style="color:blue">'+data+'你好!</span>';
    }
}
//-->
</script>
</head>

<body>
<div id="result"></div>
<div id="list"></div>
<form name="form" id="form" method="post">
<input type="hidden" name="ajax" value="1">

  用户名:<input type="text" name="user_name" /><br />
  <input type="button" name="button" value="检查" onclick="add()" />




</form>


</body>
</html>
action代码:<?php
 
 class MessageACtion extends Action{
     
     
     public function index(){
         
         $this->display();
         
         
         
         }
        public function add(){
        if($_POST['user_name'] == 'admin'){
            $this->ajaxReturn($_POST['username'],'用户名正确~',1);
            // success 方法返回
            //$this->success('用户名正确~',true);
            // 加载了 Js/Form/CheckForm.js 类库或提交了 ajax=1 隐藏表单元素
            //$this->success('用户名正确~');
        }else{
            $this->ajaxReturn('','用户名错误!',0);
            // error 方法返回
            //$this->error('用户名错误!',true);
            // 加载了 Js/Form/CheckForm.js 类库或提交了 ajax=1 隐藏表单元素
            //$this->error('用户名错误!');
        }
    
             
             
             
             }
     

     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     }
求解释?在网上试了很多方法 无法解决
最佳答案
评论( 相关
后面还有条评论,点击查看>>