// ajax.php
<html>
<head>
<script type="text/javascript">
function ajax() {
var xmlhttp;
//check the xml object comptbl
if (window.xmlHttpRequest)
xmlhttp = new XMLHttpRequest();
else
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.onreadystatechange = function()
{
//check the request and make the response
if (xmlhttp.readyState == 4 & xmlhttp.status == 200)
document.getElementById("ajax").innerHTML = xmlhttp.responseText;
}
xmlhttp.open("GET", "info.html", true);
xmlhttp.send();
}
</script>
</head>
<body>
<span id="ajax">
<!--response area -->
</span>
<button type="button" onclick="ajax()">make the request</button>
</body>
</html>
在info.html //
<html>
<head>
<title>the response file</title>
</head>
<style>
h1,h3 {
color: green;
font-family : 'ALGERIAN';
}
</style>
<body>
<h1>WELCOME IM THE RESPONSE FROM THE SERVEUR</h1>
<h3>WITHOUT RELOAD THE WHOLE PAGE</h3>
</body>
</html>
答案 0 :(得分:1)
将您的//info.html更改为此
<style>
h1,h3 {
color: green;
font-family : 'ALGERIAN';
}
</style>
<h1>WELCOME IM THE RESPONSE FROM THE SERVEUR</h1>
<h3>WITHOUT RELOAD THE WHOLE PAGE</h3>
如果这不起作用,那么发送简单的文本回复..希望这会起作用