Javascript Ajax:xmlhttp.responseText响应显示完整的内部HTML,而不是所需的文本

Javascript Ajax:xmlhttp.responseText响应显示完整的内部HTML,而不是所需的文本,javascript,ajax,Javascript,Ajax,这是我的Ajax函数,它正在工作,但在调用该函数后,它会以HTML标记+必需的_文本的形式给出响应 值变量中的响应 " 代码的问题是您没有在xmlhttp.open(“post”,“remote.php?raw_id”+str,true)上使用=; 您的代码应该是- function call_funct(str){ if (str=="") { document.getElementById("scat").innerHTML="";

这是我的Ajax函数,它正在工作,但在调用该函数后,它会以HTML标记+必需的_文本的形式给出响应

值变量中的响应 "


代码的问题是您没有在
xmlhttp.open(“post”,“remote.php?raw_id”+str,true)上使用
=

您的代码应该是-

function call_funct(str){ 

   if (str=="")
    {
          document.getElementById("scat").innerHTML="";
          return;
    }
  if (window.XMLHttpRequest)
   {
     xmlhttp=new XMLHttpRequest();
   }
  else
   {
     xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
   }
 xmlhttp.onreadystatechange=function()
  {
   if (xmlhttp.readyState==4 && xmlhttp.status==200)
     {
       value = xmlhttp.responseText;
     }
  }

 xmlhttp.open("post","remote.php?raw_id="+str,true);
 xmlhttp.send();  
}

请准确地说,您确定您的php脚本没有返回html+响应,否则将包含更多代码。
function call_funct(str){ 

if (str=="")
  {
  document.getElementById("scat").innerHTML="";
  return;
  }
if (window.XMLHttpRequest)
  {
  xmlhttp=new XMLHttpRequest();
  }
else
  {
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
value = xmlhttp.responseText;
    }
  }

xmlhttp.open("post","remote.php?raw_id"+str,true);
xmlhttp.send();  
}
function call_funct(str){ 

   if (str=="")
    {
          document.getElementById("scat").innerHTML="";
          return;
    }
  if (window.XMLHttpRequest)
   {
     xmlhttp=new XMLHttpRequest();
   }
  else
   {
     xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
   }
 xmlhttp.onreadystatechange=function()
  {
   if (xmlhttp.readyState==4 && xmlhttp.status==200)
     {
       value = xmlhttp.responseText;
     }
  }

 xmlhttp.open("post","remote.php?raw_id="+str,true);
 xmlhttp.send();  
}