zoukankan      html  css  js  c++  java
  • 脚本化http

    用js代码发起http请求:(页面会刷新)

    1、设置window.location

    2、form submit()

    ajax客户端从服务端拉数据,comet服务端向客户端推数据

    当img的src为url时,会下载URL的图片。可以在url中加信息,返回图片,可以不可见。缺点,单向数据交换。

    iframe也可以通过src为url时,加载信息,但是有同源策略问题,非同源不行。

    script也可以通过src为url时,加载信息,不受限于同源策略,server返回json对象,这种技术简称:jsonp

    以上三种与这种相比,都比较复杂。常用的ajax技术是使用XMLHttpRequest对象实现的。

    XMLHttpRequest

    var request = new XMLHttpRequest();

    request.open('GET', 'hello.txt', false);

    request.setRequestHeader();

    request.send(null); get传null, post传值,应设'Content-Type'

    response:

    status, statusText

    getResponseHeader(), getAllResponseHeaders()

    responseText

    readystatechange()

    http进度事件:loadstart, timeout, abort, progress, error.

    XMLHttpRequest对象有一个responseType属性,用来指定服务器返回数据(xhr.response)的类型。

  • 相关阅读:
    httpd添加新模块
    编译httpd细节
    apache配置文件说明及一些指令
    xen原理
    EXSI的使用
    VMWare ESX server安装
    虚拟化技术
    Kvm命令集管理虚拟机
    RAID几种方式
    BZOJ1011 [HNOI2008]遥远的行星 【奇技淫巧】
  • 原文地址:https://www.cnblogs.com/wang-jing/p/4264842.html
Copyright © 2011-2022 走看看