gpt4 book ai didi

javascript - 从函数返回 xmlhttp responseText 作为返回

转载 作者:数据小太阳 更新时间:2023-10-29 04:30:18 29 4
gpt4 key购买 nike

<分区>

我是 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>

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com