ajax的问题

xiongbing529 2007-07-31 07:52:24
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<script>
function postRequest(strURL){
var xmlHttp;
if(window.XMLHttpRequest){ // For Mozilla, Safari, ...
var xmlHttp = new XMLHttpRequest();
}
else if(window.ActiveXObject){ // For Internet Explorer
var xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlHttp.open('POST', strURL, true);
xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xmlHttp.onreadystatechange = function(){
if (xmlHttp.readyState == 4){

}
}
xmlHttp.send(strURL);
}



function call_login(){
var username = document.form1.select1.value;

var url = "login.php?pid=" + username ;
postRequest(url);
}
</script>

<form name="form1">
<select name="select1" id="select1" onchange="return call_login()">
<?
$con=mysql_connect("localhost","root","331200");
mysql_select_db("shop");
$re=mysql_query("select * from parent");
while($r=mysql_fetch_array($re))
{
?>
<option value=<? echo $r[0];?>><? echo $r[1];?></option>
<?
}
?>
</select>
<input type="text" id="id2" value="<? echo $pid;?>">
</form>

我通过select1里面选数据.通过得到的数据 ..进行无刷新数据库查询..
把结果返回到text中..为什么显示错误啊
...全文
137 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
mysqlaping 2007-08-01
  • 打赏
  • 举报
回复
这个只是post数据啊,没有返回结果。
lizyl 2007-08-01
  • 打赏
  • 举报
回复
思维很乱,建议你看看AJAX的例子
zhys9 2007-07-31
  • 打赏
  • 举报
回复
显示有什么错误?
js错误?

21,886

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧