zoukankan      html  css  js  c++  java
  • Javascript Ajax请求

    Ajax请求参数

    一、url(默认值: 当前页地址)

    类型:String

    发送请求的地址。

    二、type(默认值: "GET")

    类型:String

    请求方式 ("POST" 或 "GET")。注意:其它 HTTP 请求方法,如 PUT 和 DELETE 也可以使用,但仅部分浏览器支持。

    三、data

    类型:PlainObject 或 String 或 Array

    发送到服务器的数据。如果不是字符串格式,将自动转换为请求字符串格式。GET 请求中将附加在 URL 后。请参阅processData选项,以防止这种自动处理。实体必须为 Key/Value 格式。如果为数组,jQuery 将自动为不同值对应同一个名称。如 {foo:["bar1", "bar2"]} 转换为 '&foo=bar1&foo=bar2'。

    附:PlainObject

    The PlainObject type is a JavaScript object containing zero or more key-value pairs. The plain object is, in other words, an Objectobject. It is designated "plain" in jQuery documentation to distinguish it from other kinds of JavaScript objects: for example, null, user-defined arrays, and host objects such as document, all of which have a typeof value of "object." The jQuery.isPlainObject() method identifies whether the passed argument is a plain object or not, as demonstrated below:

    var a = [];
    var d = document;
    var o = {};
     
    typeof a; // object
    typeof d; // object
    typeof o; // object
     
    jQuery.isPlainObject( a ); // false
    jQuery.isPlainObject( d ); // false
    jQuery.isPlainObject( o ); // true
  • 相关阅读:
    A
    Hdu 1856(离散化+并查集)More is better
    Hat’s Words hdu-1247
    K
    I
    L
    F
    M
    Javascript 编码规范
    Chrome开发者工具之JavaScript内存分析
  • 原文地址:https://www.cnblogs.com/zhanghaomars/p/8245565.html
Copyright © 2011-2022 走看看