jQuery ajaxSend() Method

Last Updated:

jQuery ajaxSend() Method

jQuery will trigger the ajaxSend() method whenever an Ajax request is about to be sent.

Example

HTML Online Compiler
<!DOCTYPE html> <html lang="en-US"> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> </head> <body> <h1>jQuery ajaxSend() Method</h1> <p>Click on the button to send ajax request.</p> <button>Click Me</button> <script> $(document).ready(function(){ $("button").click(function(){ $.get("/greet.php",function(data){ alert(data); }); }); $(document).ajaxSend(function() { alert("AJAX request is sent."); }); }); </script> </body> </html>

Syntax

Syntax

$.ajaxSend(function(event, xhr, options));

Parameter Values

ValueTypeExplanation
event Optional Contains the event object.
xhr Optional Contains the XMLHttpRequest object.
options Optional Contains the used options in AJAX request.

Browser Support

Devicedesktopmobile
Browsergoogle chromesafarifirefoxinternet Exploreredgeoperagoogle chromesafarifirefoxedgeoperaandroid webviewsamsung internet
ajaxSend()YesYesYesYesYesYesYesYesYesYesYesYesYes

Share this Page

Meet the Author