<分区>
我是 javascript 和 php 的新手,我的目标是:从 xmlhttp responseText 返回字符串到函数返回值。所以我可以将它与 innerText 或 innerHTML 方法一起使用。 html 代码:
<script>
function loadXMLDoc(myurl){
var xmlhttp;
if (window.XMLHttpRequest){
xmlhttp=new XMLHttpRequest();}
else{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
xmlhttp.onreadystatechange=function(){
if (xmlhttp.readyState==4 && xmlhttp.status==200){
xmlhttp.responseText;}
}
xmlhttp.open("GET",myurl,true);
xmlhttp.send();
}
</script>