小白教程
所有教程
关于
Search
172.70.100.61
172.70.100.61
参数设置
贡献
退出
操作
编辑
移动
保护
信息
历史
删除
查看“Ajax ajaxsend”的源代码
本页内容
上一节:
Ajax_ajaxerror
下一节:
Ajax_ajaxstart
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
{{DISPLAYTITLE:ajaxSend()}}[[Category:jquery ref ajax|10]] = jQuery ajaxSend() 方法 = [[jquery ref ajax|jQuery AJAX 方法]] 当 AJAX 请求即将发送时,改变 <div> 元素的内容: <sample title="" desc="" lang="html" hererun="1"> $(document).ajaxSend(function(e,xhr,opt){ $("div").append("<p>Requesting: " + opt.url + "</p>"); }); </sample> <run name=""> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>小白教程(xiaobai.wang)</title> <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"> </script> <script> $(document).ready(function(){ $(document).ajaxSend(function(e,xhr,opt){ $("div").append("<p>Requesting " + opt.url + "</p>"); }); $("button").click(function(){ $("div").load("demo_ajax_load.php"); }); }); </script> </head> <body> <div><h2>使用 AJAX 修改文本</h2></div> <button>修改内容</button> </body> </html> </run> == 定义和用法 == ajaxSend() 方法规定 AJAX 请求即将发送时运行的函数。 '''注意:'''自 jQuery 版本 1.8 起,该方法只被附加到文档。 == 语法 == <pre> $(document).ajaxSend(function(event,xhr,options)) </pre> {| class="table table-striped table-hover" !width="50%"| 参数 !width="50%"| 描述 |- | function(event,xhr,options) | 必需。规定当请求成功时运行的函数。 额外的参数: * event - 包含 event 对象 * xhr - 包含 XMLHttpRequest 对象 * options - 包含 AJAX 请求中使用的选项 |} [[jquery ref ajax|jQuery AJAX 方法]]
返回至“
Ajax ajaxsend
”。
上一节:
Ajax_ajaxerror
下一节:
Ajax_ajaxstart