XHR2-XMLHttpRequest

来源:互联网 发布:ssm框架的crm系统源码 编辑:程序博客网 时间:2024/05/14 04:57
XMLHttpRequestLevel 2的一些新特性:

  • 设置过期时间
  • 使用FormData更好的数据托管
  • 传送二进制流
  • 添加了发送进度改变事件,可以侦听发送了多少字节。
  • 允许安全跨域,类似于加载其他域的script.
  • 可复写加载内容的MIME type和编码


XHR的事件例表:

attributetypeExplanationonloadstartloadstartWhen the request starts.onprogressprogressWhile loading and sending data.onabortabortWhen the request has been aborted, either by invoking theabort() method or navigating away from the page.onerrorerrorWhen the request has failed.onloadloadWhen the request has successfully completed.ontimeouttimeoutWhen the author specified timeout has passed before the requestcould complete.onloadendloadendWhen the request has completed, regardless of whether or not itwas successful.
原创粉丝点击