Easy Tutorial
❮ Prop Jquery Fx Off Jquery Ref Traversing ❯

jQuery getScript() Method

jQuery AJAX Methods

Example

Use AJAX to request, fetch, and run JavaScript:

$("button").click(function(){
    $.getScript("demo_ajax_script.js");
});

Definition and Usage

The getScript() method uses an AJAX HTTP GET request to fetch and execute JavaScript.


Syntax

Parameter Description
url Required. Specifies the URL to send the request to.
success(response,status) Optional. Specifies a function to run if the request succeeds. <br> Additional parameters: <br> response - Contains the result data from the request <br> status - Contains the status of the request ("success", "notmodified", "error", "timeout", "parsererror")

jQuery AJAX Methods

❮ Prop Jquery Fx Off Jquery Ref Traversing ❯