podcast1
新手上路

UID 78814
精华
0
积分 35
帖子 30
金钱 35 喜悦币
威望 0
人脉 0
阅读权限 10
注册 2006-8-22
状态 离线
|
[php-ajax问题求救] 为什么通过php无法传递参数到ajax函数中?
为什么通过php无法传递参数到ajax函数中:代码如下:
<html>
<head>
<script language="javascript">
//初始化一个xmlhttp对象
//开始请求
function startRequest(isolate)
{
var url = "4-1-1.php";
var show = document.getElementById("show");
..........
xmlHttp.open("GET", url, true);
//获取执行状态
xmlHttp.onreadystatechange = function() {
//如果执行是状态正常,那么就把返回的内容赋值给上面指定的层
if ((xmlHttp.readyState == 4)&& if (xmlHttp.status == 200) ){
show.innerHTML = xmlHttp.responseText;
}
}
xmlHttp.send(null);
}
</script>
</head>
<body>
<?php
include 'conn.php';
$node_res = mysql_query("
SELECT .......................//此处为数据库的查询语句);
while($rode_res_row = mysql_fetch_row($node_res))
echo "<a href=\"#\" onclick=\"startRequest($rode_res_row[0])\">$rode_res_row[0]</a>";
?>
<div id="show"></div>
</body>
</html>
执行数据库的功能没有问题,ajax程序本身也没有问题。
echo "<a href=\"#\" onclick=\"startRequest($rode_res_row[0])\">$rode_res_row[0]</a>"所产生的链接无法继续点击,否则总是说A或B(即$rode_res_row[0]的实际值未定义),$rode_res_row[0]是startRequest的参数,
我不知道问题出在什么地方?
求教于各位大侠!!!!
|
|