[急求]ajax刷新div时的url地址有关问题

[急求]ajax刷新div时的url地址问题
本帖最后由 lyf091 于 2013-11-12 11:43:06 编辑
目的是实现点击more按钮 根据分类的id在div中输出当前分类下的所有文章
这部分代码在网页版已实现 在手机版却无法实现
附上代码:
JS部分:
<script type="text/javascript">
     var test = function(){
           creatReq();
     }
    var req; //定义变量,用来创建xmlhttprequest对象
    function creatReq() // 创建xmlhttprequest,ajax开始
    {var url="list.php?id=<?php echo $list['id']?>"; //要请求的服务端地址
关键是这句,点击more后能输出如下地址list.php?id=,完整的地址应该是list.php?id=1,2,3,4,5
后面的这部分参数输出不出来了

        alert(url)
        
        if(window.XMLHttpRequest) //非IE浏览器及IE7(7.0及以上版本),用xmlhttprequest对象创建
        {
            req=new XMLHttpRequest();
        }
        else if(window.ActiveXObject) //IE(6.0及以下版本)浏览器用activexobject对象创建,如果用户浏览器禁用了ActiveX,可能会失败.
        {
            req=new ActiveXObject("Microsoft.XMLHttp");
        }
         
        if(req) //成功创建xmlhttprequest
        {
            req.open("post",url,true); //与服务端建立连接(请求方式post或get,地址,true表示异步)
            req.onreadystatechange = callback; //指定回调函数
            req.send(null); //发送请求
        }
    }
 
    function callback() //回调函数,对服务端的响应处理,监视response状态
    {
        if(req.readyState==4) //请求状态为4表示成功
        {
            if(req.status==200) //http状态200表示OK
            {
                Dispaly(); //所有状态成功,执行此函数,显示数据
            }
            else //http返回状态失败
            {
                alert("服务端返回状态" + req.statusText);
            }
        }
        else //请求状态还没有成功,页面等待
        {
             
            document.getElementById ("imain_main").innerHTML ="数据加载中";
        }
    }
 
    function Dispaly() //接受服务端返回的数据,对其进行显示
    {
        document .getElementById ("imain_main").innerHTML =req.responseText;
        //alert(req.responseText);
    }
</script>


list.php页面:
<?php
/**
 *文章列表页
 */
include_once '../global.php';

$id = !empty($id) ? intval($id) : 0;
$category = array();
$category = getCategoryById($id);
?>


             <?php foreach(getCategoryList( '1,2,16') as $list){?>
             <?php }?>
                                    
                                
                            </table>
                </div>
                <!--输出文章列表信息-->
                 <div class="main_right">
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="news">