Jquery Ajax xml版Get请求PHP
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="utf-8">
<title></title>
<style>
</style>
</head>
<body>
<input type="button" value="AJAX提交"/>
<p id="resText"></p>
</body>
<script src="../js/jquery-1.11.3.js"></script>
<script>
$(function(){
$(":input").click(function(){
var xmlHttpReq=null;
if(window.ActiveXObject){
xmlHttpReq=new ActiveXObject("Microsoft.XMLHTTP");
}else if(window.XMLHttpRequest){
xmlHttpReq=new XMLHttpRequest();
}
xmlHttpReq.open("GET","text.php",true);
function RequestCallback(){
if(xmlHttpReq.readyState==4&&xmlHttpReq.status==200){
document.getElementById('resText').innerHTML=xmlHttpReq.responseText;
console.log(typeof xmlHttpReq.responseText);
}
}
xmlHttpReq.onreadystatechange=RequestCallback;
xmlHttpReq.send(null);
});
})
</script>
</html>