Upload 最原始方式 form表单提交 兼容性:所有浏览器都支持。 xhr2 关于xhr: 老版本xhr主要属性: xhr.readyState:XMLHttpRequest对象的状态,等于4表示数据已经接收完毕。 xhr.status:服务器返回的状态码,等于200表示一切正常。 xhr.re ...
分类:
编程语言 时间:
2018-10-13 14:41:47
阅读次数:
171
当请求被发送到服务器时,我们需要执行一些基于响应的任务。 每当 readyState 改变时,就会触发 onreadystatechange 事件。 readyState 属性存有 XMLHttpRequest 的状态信息。 下面是 XMLHttpRequest 对象的三个重要的属性: 存有 XML ...
分类:
其他好文 时间:
2018-08-26 20:50:11
阅读次数:
226
var oFrm = document.getElementById('Iframe4'); oFrm.onload = oFrm.onreadystatechange = function () { if (this.readyState && this.readyState != 'comple... ...
分类:
其他好文 时间:
2018-08-23 19:24:41
阅读次数:
155
原生js实现Ajax方法: 注释: 1.open(method, url, async) 方法需要三个参数: 2.send() 方法可将请求送往服务器。 3.onreadystatechange:存有处理服务器响应的函数,每当 readyState 改变时,onreadystatechange 函数 ...
分类:
Web程序 时间:
2018-08-22 21:55:28
阅读次数:
171
websocket的两个属性:readyState和bufferedAmount。 根据readyState属性可以判断webSocket的连接状态,该属性的值可以是下面几种: 0 :对应常量CONNECTING (numeric value 0), 正在建立连接连接,还没有完成。The conne ...
分类:
Web程序 时间:
2018-08-03 14:43:49
阅读次数:
636
ajax:请求 响应 js //创建ajax对象 var xhr=new XMLHttpRequest(); //监听ajax状态 xhr.onreadystatechange=function(){ if(xhr.readyState == 4){ console.log(xhr.response ...
分类:
Web程序 时间:
2018-07-21 16:57:30
阅读次数:
821
const getJSON = function(url,type,data) { const promise = new Promise(function(resolve, reject){ const handler = function() { if (this.readyState !== ...
分类:
其他好文 时间:
2018-07-03 14:37:02
阅读次数:
173
mybutton.addEventListener('click', (e) => { let request = new XMLHttpRequest() request.onreadystatechange = () => { if(request.readyState === 4) { con... ...
分类:
Web程序 时间:
2018-06-16 10:34:14
阅读次数:
224
a. Number readyState 状态值(整数) 详细: 0-未初始化,尚未调用open()方法; 1-启动,调用了open()方法,未调用send()方法; 2-发送,已经调用了send()方法,未接收到响应; 3-接收,已经接收到部分响应数据; 4-完成,已经接收到全部响应数据; b. ...
分类:
Web程序 时间:
2018-06-10 00:21:26
阅读次数:
230
ajax请求: 1、这里介绍下原生方法:get方法: function getMethod(){ var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function(){ if(xhr.readystate == 4){ if((xhr ...
分类:
Web程序 时间:
2018-06-06 16:52:14
阅读次数:
182