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 Object
object. 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