ajax ajaxSend() method
Translation results:
Ajax
English [ˈeɪˌdʒæks] American [ˈeˌdʒæks]
n. The full name is "Asynchronous JavaScript and XML" (asynchronous JavaScript and XML); refers to a A web development technology for creating interactive web applications. ; Ajax copper-tin-lead bearing alloy, Yajis explosive
send
UK[send] US[sɛnd]
vt.Send ; dispatch; cause to make (a certain reaction); cause to enter (a certain state)
vt.& vi. Send by radio waves, send out information
vi. Dispatch, send out, send people
adj.[only used as an attributive]
used for sendingajax ajaxSend() methodsyntax
Function: ajaxSend() method executes the function when the AJAX request starts. It is an Ajax event.
Syntax: .ajaxSend([function(event,xhr,options)])
##Parameters:
Description | |
Required. Specifies that the function should be executed when the request is started. Additional parameters: event - contains the event object xhr - contains the XMLHttpRequest object options - contains the options used in the AJAX request. |
Description: The XMLHttpRequest object and settings are passed as parameters to the callback function.
ajax ajaxSend() methodexample
<html> <head> <script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("div").ajaxSend(function(e,xhr,opt){ $(this).html("正在请求:" + opt.url); }); $("button").click(function(){ $("h2").text("文本已经改变"); alert("请求成功"); }); }); </script> </head> <body> <div id="txt"><h2>通过 AJAX 改变文本</h2></div> <button>改变内容</button> </body> </html>
Click the "Run instance" button to view the online instance