jquery ajax事件之-ajaxSend() 方法

  实例 当 AJAX 请求即将发送时,改变 div 元素的内容:

 $("div").ajaxSend(function(e,xhr,opt){
  $(this).html("Requesting " + opt.url);
});

定义和用法 ajaxSend() 方法在 AJAX 请求开始时执行函数。它是一个 Ajax 事件。
语法

 .ajaxSend([function(event,xhr,options)])

参数 描述 function(event,xhr,options) 必需。规定当请求开始时执行函数。
额外的参数:
event - 包含 event 对象
xhr - 包含 XMLHttpRequest 对象
options - 包含 AJAX 请求中使用的选项
详细说明 XMLHttpRequest 对象和设置作为参数传递给回调函数。

转载于猿2048:➬《jquery ajax事件之-ajaxSend() 方法》

评论

暂无评论