ajax在firefox40,360chrome,IE11均无法运行,不知错在哪里,该怎么解决
ajax在firefox40,360chrome,IE11均无法运行,不知错在哪里
看了不同老师视频教程做的,环境win10 企业长期服务版64位,百思不得其解,不知是否大小写出错,麻烦高手看一下,谢谢
下面的for.php 只有一句,输出echo "1111111";
另一个实例,也是无法运行
02.php 代码 只有一句
------解决思路----------------------
2http://www.w3school.com.cn/tiy/t.asp?f=ajax_get
看了不同老师视频教程做的,环境win10 企业长期服务版64位,百思不得其解,不知是否大小写出错,麻烦高手看一下,谢谢
下面的for.php 只有一句,输出echo "1111111";
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script type="text/javascript" language="javascript">
var xmlHttp;
function S_xmlhttprequest() {
if (window.ActiveXObject) {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
} else if (window.XMLHttpRequest) {
xmlHttp = new XMLHttpRequest();
}
}
function funphp100(url) {
S_xmlhttprequest();
xmlHttp.open("GET","for.php?id="+url,true);
xmlHttp.onreadystatechang=byphp;
xmlHttp.send(null);
}
function byphp() {
var byphp100 = xmlHttp.responseText;
document.getElementById('php100').innerHTML = byphp100;
}
</script>
</head>
<body>
<a href="#" onclick="funphp100('o')">o</a><br />
<div id="php100"></div>
</body>
</html>
另一个实例,也是无法运行
<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
<head>
<title>IE6,7,8,9,10,11无法接收ajax请求</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script type="text/javascript">
function f1() {
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
// console.log(xhr.readyState);
if (xhr.readyState === 4){
document.getElementById('result').innerHTML = xhr.responseText;
//console.log(xhr.responseText);
}
};
xhr.open('get','./02.php');
xhr.send(null);
}
</script>
</head>
<body>
<div>ajax接收数据</div>
<input type="button" value="触发" onclick="f1()" />
<div id="result"></div>
</body>
</html>
02.php 代码 只有一句
echo "<div style='color:blue;'>aaaa</div>";
------解决思路----------------------
2http://www.w3school.com.cn/tiy/t.asp?f=ajax_get