摘要: //1创建对象 XMLHttpRequest var request = createXHR(); function createXHR() {//判断浏览器兼容 var xhr; if (XMLHttpRequest) { xhr = new XMLHttpRequest(); } else { xhr = new ActiveXObject("Microsoft.XMLHTTP"); } return xhr; } function send() { document.getElementById("d").innerHTML = "加载中 阅读全文
posted @ 2013-10-17 11:50 nqsan 阅读(211) 评论(0) 推荐(0) 编辑
摘要: --ajax 笔记.一.XMLHttpRequest1.创 new 2.请求 open 3.注册 onreadyState 4.发送 send二.html静态页面执行速度快于动态页面.三.ajax 请求常见问题1.中文乱码 ->通过 编码解决.2.浏览器缓存->通过参数+Math.random()方法,2.2设置请求头3.解决服务器不可预知的错误.->readyState 是xmlhttpRequest对象状态码. status 是http响应的状态码 阅读全文
posted @ 2013-10-17 11:43 nqsan 阅读(130) 评论(0) 推荐(0) 编辑