<?php
echo 'hello';
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
p {
width: 100px;
height: 100px;
border: 1px solid red;
}
</style>
</head>
<body>
<p></p>
<script type="text/javascript">
var op = document.getElementsByTagName('p')[0];
op.addEventListener('click', function(e) {
var xml = new XMLHttpRequest();
xml.onreadystatechange = function() {
if(xml.readyState === 4) {
if((xml.status >= 200 && xml.status < 300) || xml.status == 304) {
document.body.innerHTML+=xml.responseText;
}
}
}
xml.open('GET', '002.php', true);
xml.send();
})
</script>
</body>
</html>
php echo里面的内容为啥不对啊?和ajax,responseText获取的数据不一样,为什么。。
凤凰求蛊
相关分类