无法在xampp

时间:2017-01-23 15:56:04

标签: javascript php xampp

在我的Xampp htdocs文件中,我放置了下面的html代码,以及一个php文件test.php,其内容也在下面给出。当我单击按钮时,我没有收到任何错误消息,唉,没有迹象表明php程序已经运行。有什么建议 ?

我还应该补充一点,使用:form action =“http://localhost/test.php”构造,test.php确实会执行。

<!DOCTYPE html>
<html>
<head>

<script>
var xmlhttp;
function loadXMLDoc() {

   xmlhttp = new XMLHttpRequest();

  xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
   document.getElementById("demo").innerHTML = "xxx";
     } ;
}
       xmlhttp.open("GET", "http://localhost/test.php", true);
  xmlhttp.send();
}

</script>
</head>
<body>

<h2>Using the XMLHttpRequest object</h2>

<button type="button" onclick="loadXMLDoc()">Change Content</button>

<p id="demo"></p>
</body>

The test.php module is just:
<?php
echo "Hello there"
?>

0 个答案:

没有答案