试用了一下xAjax,有点问题,不知道如何解决,请高手指点。
 出错提示:the XML response that was returned from the server is invalid;
 代码如下:
试用了一下xAjax,有点问题,不知道如何解决,请高手指点。
 出错提示:the XML response that was returned from the server is invalid;
 代码如下:
CODE:
require('xajax/xajax.inc.php');        //    外部引用;
function showInfo($selectID)
{
    $conn=mysql_connect("localhost","root","");
    $sql="SELECT id,title FROM news_article WHERE sortid=7 LIMIT 0,10";
    $result=mysql_db_query("biotech",$sql);
    while($arr=mysql_fetch_array($result))
    {
        $zt1.="<a href=http://localhost/news/news/show.php?id=".$arr['id'].">".$arr['title']."</a><BR>";
    }
    echo $zt1;
    $zt1=iconv("GB2312", "UTF-8",$zt1);
    $objResponse=new xajaxResponse();
    $objResponse->addAssign($selectID,"innerHTML",$zt1);
    return $objResponse;
}
$xajax=new xajax();
$xajax->registerFunction("showInfo");
$xajax->processRequests();
?>
<html>
    <head>
    <meta HTTP-EQUIV="content-type" CONTENT="text/html; charset=UTF-8">
        <title>Xajax试用</title>
        <?php $xajax->printJavascript();?>
    </head>
<body>
 测试Xajax<!--读出数据库-->生成动态表格。
 <input type="button" onclick="<?php echo "xajax_showInfo('zt1')"; ?>" value="专题报道一">
  
 <span id="zt1" width="35%"></span> 
 <BR>
 <span id="zt2" width="35%"></span>
 </body>
</html>