嗨,我试图在按钮单击时使用ajax调用多个URL,但它无法正常工作
这是我的代码
<!DOCTYPE html>
<html>
<head>
<script>
function loadXMLDoc(cfun)
{
var xmlhttp;
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=cfunc;
xmlhttp.open("GET",url/sendmessage.php?user=password=&mobile=7828208357&message=hello dear shakti&sender=&type=3INFORM",true);
xmlhttp.send();
}
function myFunction()
{
loadXMLDoc("GET","demo.html",function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
}
});
}
</script>
</head>
<body>
<h2>AJAX</h2>
<button type="button" onclick="myFunction()">Request data</button>
<div id="myDiv">
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
我错的地方我怎样才能做到这一点
任何帮助将不胜感激