jQuery ajax - ajaxSend() 方法
實(shí)例
當(dāng) AJAX 請(qǐng)求即將發(fā)送時(shí),改變 div 元素的內(nèi)容:
$("div").ajaxSend(function(e,xhr,opt){
$(this).html("Requesting " + opt.url);
});
定義和用法
ajaxSend() 方法在 AJAX 請(qǐng)求開(kāi)始時(shí)執(zhí)行函數(shù)。它是一個(gè) Ajax 事件。
語(yǔ)法
.ajaxSend([function(event,xhr,options)])
| 參數(shù) | 描述 |
|---|---|
| function(event,xhr,options) |
必需。規(guī)定當(dāng)請(qǐng)求開(kāi)始時(shí)執(zhí)行函數(shù)。 額外的參數(shù):
|
詳細(xì)說(shuō)明
XMLHttpRequest 對(duì)象和設(shè)置作為參數(shù)傳遞給回調(diào)函數(shù)。