Javascript Ajax请求

Ajax请求参数javascript

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

类型:Stringjquery

发送请求的地址。web

2、type(默认值: "GET")api

类型:String数组

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

3、data服务器

类型:PlainObject 或 String 或 Arrayide

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

附: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
相关文章
相关标签/搜索