js ajax读取 写入
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>js中的Ajax经典实例</title>
<script type="text/javascript" >
function ajax() {
//1.声明异步请求对象:
var xmlHttp = null;
if (window.ActiveXObject) {
// IE6, IE5 浏览器执行代码
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
} else if (window.XMLHttpRequest) {
// IE7+, Firefox, Chrome, Opera, Safari 浏览器执行代码
xmlHttp = new XMLHttpRequest();
}
//2.如果实例化成功,就调用open()方法:
if (xmlHttp != null) {
xmlHttp.open("get", "songs.txt", true);
xmlHttp.send();
x