您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

ajax+php的有关问题

2024/3/5 6:14:34发布36次查看
ajax+php的问题
有好几个checkbox循环出来,还有个文本框
html code

以下是ajax:jscript codefunction showinfor(str) { //document.getelementbyid(txtid).value=str; //var str = document.geelementbyid(ckid).value; //document.write(str); var xmlhttp; if (id.length==0) { document.getelementbyid(txtid).value=; return; } if (window.xmlhttprequest) {// code for ie7+, firefox, chrome, opera, safari xmlhttp=new xmlhttprequest(); } else {// code for ie6, ie5 xmlhttp=new activexobject(microsoft.xmlhttp); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readystate==4 && xmlhttp.status==200) { //document.getelementbyid(show).innerhtml=xmlhttp.responsetext; document.getelementbyid(txtid).value=xmlhttp.responsetext; } } xmlhttp.open(get,showsettle.php?q=+str,true); xmlhttp.send();}
然后是对于的php页面php code$db = mysql_connect(localhost,root,1234);mysql_select_db(it database,$db);$q=$_get['q']; // connecting to database and stuff... echo $q; $temp = mysql_query(select mis_id from materialinstorage where mis_id = '$q' ); echo $temp;$row = mysql_fetch_array($temp); $id =$row['mis_id']; echo $id;
现在好像是php那页面不执行,没反应啊。
我在ajax里执行document.write(str);可以得到数据的。
请问哪里出错了呀
------解决方案--------------------
弄个google浏览器或者firebug一看就知道了!
------解决方案--------------------
探讨
他说我id为定义
我把ajax里的id.length==0改成了xmlhttp==null
可效果还是一样的,状态栏里也没显示网页错误了
------解决方案--------------------
if (id.length==0)
这个 id 没有定义
------解决方案--------------------
一步一步调试。首先alert(xmlhttp.responsetext); 看能不能弹出php端的输出。
------解决方案--------------------
html codedocument.getelementbyid(txtid).value=;应该是这句,这是什么错啊 //跟你这句没关系的,这句只是设置文本框中的值为空if (id.length==0){ //是这段的处理,主要是id.length这个没有定义,不懂这段做什么,是判断复选框是否被选? 检查下这段 document.getelementbyid(txtid).value=; return; }

该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product