xmlHttp.responseXML为null

WBOY
Release: 2016-06-23 13:54:01
Original
976 people have browsed it


回复讨论(解决方案)

你ajax里定的什么格式??

nbsp;html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">



无标题文档



    header("Content-type:text/html;charset='GBK'");
$id=$_GET["key"];
    $link=mysql_connect("localhost","root","");
mysql_select_db("enterprise");
mysql_query("set names 'GBK'");
$sql="select * from etp_news where id=".$id;
$result=mysql_query($sql);
while($rs = mysql_fetch_object($result)){

$tit=$rs->tit;
$cont=$rs->content;
$name=$rs->source;
?>
     


    
        
            
            
             
        
标题 " />
正文
作者 " />
" />
             

    

   
   
   <script> <br /> var xmlHttp; <br /> function createXMLHttpRequest(){ <br /> if(window.ActiveXObject){ <br /> xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); <br /> }else if(window.XMLHttpRequest){ <br /> xmlHttp=new XMLHttpRequest(); <br /> } <br /> <br /> } <br /> <br /> <br /> function upd(){ <br /> createXMLHttpRequest(); <br /> <br /> var id=document.getElementById("id").value; <br /> var title=document.getElementById("title").value; <br /> var name=document.getElementById("name").value; <br /> var cent=document.getElementById("cent").value; <br /> var str="id="+id+"&title="+title+"&name="+name+"&cent="+cent; <br /> var url="php/update.php"; <br /> xmlHttp.open("POST",url,true); <br /> xmlHttp.onreadystatechange=callback; <br /> xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); <br /> xmlHttp.send(str); <br /> <br /> } <br /> <br /> <br /> function callback(){ <br /> if(xmlHttp.readyState==4){ <br /> if(xmlHttp.status==200){ <br /> var strs=xmlHttp.responseText; <br /> <br /> if(strs=="1"){ <br /> alert("数据已修改"); <br /> } <br /> } <br /> } <br /> } <br /> </script>

你怎么只看返回内容的后半部呢?前半部是 php 的错误信息,为什么视而不见呢?
两部分合在一起还能算是 XML 吗?




求指教

错误信息明确的告诉你 sel_News.php 第 18 行处变量 $content 不存在
你不按错误信息改错,光抱拳有什么用?



不加$ctent.  只显示一条
加了就出错,找不到ctent,我需要让他循环显示啊

感谢 版主提醒  问题ok了

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template