-1
它应该显示172-ajax-include.php当用户点击提交按钮。但它不起作用。我认为我做对了。无法弄清楚我做错了什么。为什么我的阿贾克斯工作
<html>
<head>
<script type="text/javascript">
function load()
{ /* start function load */
if (window.XMLHttpRequest)
{ /* 1 if start */
xmlhttp = new XMLHttpRequest();
} /* 1 if end */
else
{ /* 1 else start */
xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');
} /* 1 else end */
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200 /* the 200 makes sure that it's not empty*/)
{ /* 2 if start */
document.getElementById('adiv'),innerHTML = xmlhttp.responseText;
} /* 2 if end */
xmlhttp.open('GET', '172-ajax-include.php', true);
xmlhttp.send();
}
} /* end function load */
</script>
</head>
<body>
<input type="submit" onclick="load();">
<div id="adiv"></div>
</body>
</html>
谢谢AVD,但它仍然没有工作,我试过了。有任何想法吗? – 2012-02-05 06:57:08
更改按钮类型。 – adatapost 2012-02-05 07:03:54
谢谢老兄。我也搞砸了最后一条陈述。我用逗号代替了句点。是!得到它的工作。 – 2012-02-05 07:13:57