Ajax实例
2016-04-04 14:47
405 查看
原文链接:http://www.cnblogs.com/Arther-J/p/5352026.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" 2 "http://www.w3.org/TR/html4/strict.dtd"> 3 4 <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> 5 <head> 6 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 7 <title>Ajax实例</title> 8 <script type="text/javascript" src="script/jquery-1.12.2.js"></script> 9 <meta name="author" content="Administrator" /> 10 <!-- Date: 2016-04-04 --> 11 </head> 12 <body> 13 <input type="button" value="Ajax提交" onclick="Ajax();" /> 14 <div id="resText"></div> 15 <script type="text/javascript"> 16 function Ajax() { 17 var xmlHttpReg = null; 18 if(window.ActiveXObject){ 19 xmlHttpReg = new ActiveXObject("Microsoft.XMLHTTP"); 20 }else if(window.XMLHttpRequest){ 21 xmlHttpReg = new XMLHttpRequest(); 22 } 23 xmlHttpReg.open("GET","test.php",true); 24 xmlHttpReg.onreadystatechange = RequsetCallBack; 25 xmlHttpReg.send(null); 26 function RequestCallBack() { 27 if(xmlHttpReg.readyStatus==4){ 28 if(xmlHttpReq.status==200){ 29 document.getElementById("resTest").innerHTML = xmlHttpReq.responseText; 30 } 31 } 32 } 33 } 34 </script> 35 </body> 36 </html>
转载于:https://www.cnblogs.com/Arther-J/p/5352026.html
相关文章推荐
- Spring MVC+Ajax创建实例
- Ajax设计:字段增量验证实例
- Ajax+Struts2实例
- Ajax+SpringMVC+Spring+Mybatis+MySql+js用户注册实例
- Jquery Ajax学习实例7-Ajax所有过程事件分析示例
- ajax调用简单实例
- IE浏览器与FF浏览器关于Ajax传递参数值为中文时的区别实例分析
- 第39篇 一对多自由控制语音(十九)及PHP 实例- AJAX 投票
- AJAX与JSF实现带进度条的批量上传文件实例
- struts+json+ajax实例
- JQuery的Ajax跨域请求原理概述及实例
- Jquery之Ajax实例_登录
- jQuery+JSON实现AJAX二级联动实例分析
- Jquery具体实例介绍AJAX何时用,AJAX应该在什么地方用
- AJAX实例入门
- ajax实例:如何使用json+ajax的方法实现类似前端特效tab切换效果
- AJAX编写的用户注册实例及技术小结
- 基于ajax和jsonp的原生封装(实例)
- ajax+php+jquery+json 跨域实例
- ajax跨域请求操作实例