ajax实例AJAX异步传输用到哪些对象?具体实例。

ajax实例  时间:2022-03-02  阅读:()

AJAX异步传输用到哪些对象?具体实例。

function ajax(){ this.method; this.url; this.responsetype; this.content; var http_request = false; this.getExecObj = function(reValue){ if(window.XMLHttpRequest) { http_request = new XMLHttpRequest(); if (http_request.overrideMimeType) { http_request.overrideMimeType("text/xml"); } } else if (window.ActiveXObject) { try { http_request = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { http_request = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } } if (!http_request) { //window.alert("创建XMLHttpRequest对象实例失败."); return false; } if(this.method.toLowerCase()=="get") { http_request.open(this.method, this.url, true); } else if(this.method.toLowerCase()=="post") { http_request.open(this.method, this.url, true); http_request.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); } else { //window.alert("http请求类别参数错误。"); return false; } http_request.send(this.content); var reTextResponse = function() { if (http_request.readyState == 4) { if (http_request.status == 200) { reValue(http_request.responseText); } else { //alert("页面有异常。"); } } } var reXMLResponse = function() { if (http_request.readyState == 4) { if (http_request.status == 200) { reValue(http_request.responseXML); } else { //alert("页面有异常。"); } } } if(this.responsetype.toLowerCase()=="text") { http_request.onreadystatechange = reTextResponse; } else if(this.responsetype.toLowerCase()=="xml") { http_request.onreadystatechange = reXMLResponse; } else { //window.alert("参数错误。"); return false; } } } // 调用方法 var _ajax = new ajax() _ajax.method = "post"; //是get还是post _ajax.url = "Returnlist.aspx"; //请求的地址 _ajax.responsetype = "text"; //处理返回内容的类型 _ajax.content = "id=2"; //发送的内容 _ajax.getExecObj( //对返回值处理 function(str){ document.getElementById("select1").outerHTML = "<select name='select1' onchange='rsp(this)'><option value='0'>选择大产品</option>"+ str + "</select>" } ); 刚好有个项目代码 给你看看

CloudCone2核KVM美国洛杉矶MC机房机房2.89美元/月,美国洛杉矶MC机房KVM虚拟架构2核1.5G内存1Gbps带宽,国外便宜美国VPS七月特价优惠

近日CloudCone发布了七月的特价便宜优惠VPS云服务器产品,KVM虚拟架构,性价比最高的为2核心1.5G内存1Gbps带宽5TB月流量,2.89美元/月,稳定性还是非常不错的,有需要国外便宜VPS云服务器的朋友可以关注一下。CloudCone怎么样?CloudCone服务器好不好?CloudCone值不值得购买?CloudCone是一家成立于2017年的美国服务器提供商,国外实力大厂,自己开...

轻云互联,香港云服务器折后22元/月 美国云服务器 1核 512M内存 15M带宽 折后19.36元/月

轻云互联成立于2018年的国人商家,广州轻云互联网络科技有限公司旗下品牌,主要从事VPS、虚拟主机等云计算产品业务,适合建站、新手上车的值得选择,香港三网直连(电信CN2GIA联通移动CN2直连);美国圣何塞(回程三网CN2GIA)线路,所有产品均采用KVM虚拟技术架构,高效售后保障,稳定多年,高性能可用,网络优质,为您的业务保驾护航。官方网站:点击进入广州轻云网络科技有限公司活动规则:1.用户购...

HaloCloud:日本软银vps100M/200M/500M带宽,,¥45.00元/月

halocloud怎么样?halocloud是一个于2019下半年建立的商家,主要提供日本软银VPS,广州移动VDS,株洲联通VDS,广州移动独立服务器,Halo邮局服务,Azure香港1000M带宽月抛机器等。日本软银vps,100M/200M/500M带宽,可看奈飞,香港azure1000M带宽,可以解锁奈飞等流媒体,有需要看奈飞的朋友可以入手!点击进入:halocloud官方网站地址日本vp...

ajax实例为你推荐
文件下载文件下载后怎样安装起英文名根据中文名取英文名fast路由器FAST/迅捷无线路由器怎么设置招行信用卡还款招行信用卡怎么还款t320华为T320怎么样硬盘分区格式化怎样给硬盘分区并格式化网络购物的发展网络购物的发展对策相册网怎样才能把我的照片传到网上去??修复网络lspwin 7,lsp修复无法上网无线互联网笔记本电脑之间可不可以实现无线互联?如果能,该怎么联接?
域名邮箱 欧洲免费vps 阿里云os site5 128m内存 kddi godaddy续费优惠码 php探针 美国php空间 debian7 100x100头像 阿里校园 中国linux 永久免费空间 lamp是什么意思 云服务是什么意思 好看的空间 服务器托管价格 碳云 winserver2008 更多