使用xmlHttpRequest实现Ajax技术
来源:互联网 发布:阿里云的机房 编辑:程序博客网 时间:2024/05/01 04:56
前端的javascript脚本中使用使用xmlHttpRequest实现Ajax技术与后台进行交互,
后台使用php进行运算处理。
<html><head><script type="text/javascript">var xmlhttp;function loadXMLDoc(url){xmlhttp=null;if (window.XMLHttpRequest) {// code for IE7, Firefox, Opera, etc. alert(2); xmlhttp=new XMLHttpRequest();}else if( window.ActiveXObject ){alert(1111); }if (xmlhttp!=null) { xmlhttp.onreadystatechange = state_Change; xmlhttp.open("GET",url,true); xmlhttp.send(null); }else { alert("Your browser does not support XMLHTTP."); }}function state_Change(){ if (xmlhttp.readyState == 4) {// 4 = "loaded" alert(4); document.getElementById('A1').innerHTML = xmlhttp.status;document.getElementById('A2').innerHTML = xmlhttp.statusText;document.getElementById('A3').innerHTML = xmlhttp.responseText; if (xmlhttp.status==200) {// 200 = "OK" document.getElementById('A1').innerHTML=xmlhttp.status; document.getElementById('A2').innerHTML=xmlhttp.statusText; document.getElementById('A3').innerHTML=xmlhttp.responseText; } else { alert("Problem retrieving XML data:" + xmlhttp.statusText); } }}</script></head><body><h2>Using the HttpRequest Object</h2><p><b>Status:</b><span id="A1"></span></p><p><b>Status text:</b><span id="A2"></span></p><p><b>Response:</b><br /><span id="A3"></span></p><button onclick="loadXMLDoc('http://59.66.116.169/whether.php?city=beijing')">Get XML</button></body></html>
- 使用xmlHttpRequest实现Ajax技术
- 使用XMLHttpRequest实现AJAx
- 使用 XMLHttpRequest 实现 Ajax
- 使用 XMLHttpRequest 实现 Ajax
- 使用XMLHttpRequest 实现ajax效果
- 使用XMLHttpRequest 实现ajax效果
- 使用XmlHttpRequest实现简单Ajax
- 10002---使用 XMLHttpRequest 实现 Ajax
- 使用XMLHTTPRequest和JQuery库实现AJax
- [学习小结]Ajax_使用 XMLHttpRequest 实现 Ajax
- 原生js使用xmlhttpRequest实现ajax请求
- 不使用XMLHttpRequest对象实现Ajax效果
- 利用 Microsoft.XMLHTTP/XMLHttpRequest 对象 实现Ajax技术 的总结
- XMLHttpRequest、prototype实现ajax
- AJAX XMLHttpRequest 实现
- ajax使用xmlHttpRequest对象
- ajax使用XMLHTTPRequest
- ajax使用 XMLHttpRequest
- 百钱买百鸡
- 从tfs优化看分布式存储系统
- 对生活现状的思考
- POJ 1087 A Plug for UNIX
- EthernetNative 和 android_net_ethernet.cpp
- 使用xmlHttpRequest实现Ajax技术
- ACdream 群赛11.10 Problem J: I can't describe the problem
- Hibernate_一对一双向外键关联
- Objective-C内存管理教程和原理剖析(二)口诀与范式
- 利用ffmpeg解码h264流的代码
- Objective-C内存管理教程和原理剖析(三)@property (retain)和@synthesize的默认实现
- 工作中应该持有的态度
- android ethernet
- 群赛11.10 A Very Easy Triangle Counting Game