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>" } ); 刚好有个项目代码 给你看看

hypervmart:英国/荷兰vps,2核/3GB内存/25GB NVMe空间/不限流量/1Gbps端口/Hyper-V,$10.97/季

hypervmart怎么样?hypervmart是一家国外主机商,成立于2011年,提供虚拟主机、VPS等,vps基于Hyper-V 2012 R2,宣称不超售,支持linux和windows,有荷兰和英国2个数据中心,特色是1Gbps带宽、不限流量。现在配置提高,价格不变,性价比提高了很多。(数据中心不太清楚,按以前的记录,应该是欧洲),支持Paypal付款。点击进入:hypervmart官方网...

Spinservers:美国圣何塞机房少量补货/双E5/64GB DDR4/2TB SSD/10Gbps端口月流量10TB/$111/月

Chia矿机,Spinservers怎么样?Spinservers好不好,Spinservers大硬盘服务器。Spinservers刚刚在美国圣何塞机房补货120台独立服务器,CPU都是双E5系列,64-512GB DDR4内存,超大SSD或NVMe存储,数量有限,机器都是预部署好的,下单即可上架,无需人工干预,有需要的朋友抓紧下单哦。Spinservers是Majestic Hosting So...

hostkey荷兰/俄罗斯机房,GPU服务器

hostkey应该不用说大家都是比较熟悉的荷兰服务器品牌商家,主打荷兰、俄罗斯机房的独立服务器,包括常规服务器、AMD和Intel I9高频服务器、GPU服务器、高防服务器;当然,美国服务器也有,在纽约机房!官方网站:https://hostkey.com/gpu-dedicated-servers/比特币、信用卡、PayPal、支付宝、webmoney都可以付款!CPU类型AMD Ryzen9 ...

ajax实例为你推荐
硬件设计方案什么是硬件设计体系文件什么叫采购体系文件a8处理器苹果A8处理器和A9处理器有多大的区别?什么是cookie有时遇到网页提示禁止第三方cookie是什么意思?教育城域网怎样进入寿光教育城域网网站图片修改工具推荐个好用的修改图片的工具网络图绘制双代号网络图的绘制方法?网络限速软件有什么比较好的网络限速的软件burndownburn down与burn up有何区别教学视频网站最好的免费教学视频在那有?
过期备案域名查询 免费二级域名申请 免费动态域名 香港ufo 12306抢票攻略 好玩的桌面 京东商城双十一活动 爱奇艺vip免费领取 跟踪路由命令 秒杀品 贵阳电信 免费赚q币 512内存 时间服务器 phpwind论坛 windowsserver2012 一句话木马 饭桶 装修瓦工招聘 国内云主机 更多