|
函數(shù)$.ajax的解析
函數(shù):$.ajax(properties)
功能:用一個(gè)http請(qǐng)求訪問一個(gè)遠(yuǎn)程頁面
返回:XMLHttpRequest
參數(shù):
(String) url 請(qǐng)求地址;
(String) type 請(qǐng)求類型(”GET”,”POST”);
(String) dataType:從服務(wù)器端返回的數(shù)據(jù)類型(”xml”,”html”,”script”,”json”);
(Boolean) ifModified:根據(jù)Last-Modified header判斷返回內(nèi)容是否改變;
(Number) timeout:請(qǐng)求超時(shí);
(Boolean) global:對(duì)此次請(qǐng)求是否引起全局的ajax事件出來,默認(rèn)true;
(Function) error:錯(cuò)誤處理函數(shù);
(Function) complete:請(qǐng)求完成后的處理函數(shù);
(Object|String) data:發(fā)送到服務(wù)器端的數(shù)據(jù);
(String) contentType :默認(rèn)”application/x-www-form-urlencoded”;
(Boolean) processData :傳輸?shù)?a href=/yuedu/fuwuqi/ target=_blank class=infotextkey>服務(wù)器端的數(shù)據(jù)默認(rèn)被轉(zhuǎn)換到query string中以適合默認(rèn)”application/x-www-form-urlencoded”方式,如果你想以DOMDocuments方式傳輸數(shù)據(jù),就將該選項(xiàng)設(shè)為false;
(Boolean) aysnc:是否異步傳輸,默認(rèn)為true;
(Function) beforeSend:請(qǐng)求前響應(yīng)函數(shù);
例子:(加載并且執(zhí)行一個(gè)js文件)
jQuery Code
$.ajax({
type: “GET”,
url: “test.js”,
dataType: “script”
})
it知識(shí)庫:jQuery教程-函數(shù)學(xué)習(xí)之AJAX部分,轉(zhuǎn)載需保留來源!
鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請(qǐng)第一時(shí)間聯(lián)系我們修改或刪除,多謝。