jQuery getScript() Method
Example
Get and run a JavaScript using an AJAX request:
$("button").click(function(){
$.getScript("demo_ajax_script.js");
});
Try it Yourself »
Definition and Usage
The getScript() method is used to get and execute a JavaScript using an AJAX HTTP GET request.
Syntax
$(selector).getScript(url,success(response,status))
Parameter | Description |
---|---|
url | Required. Specifies the url to send the request to |
success(response,status) | Optional. Specifies the function to run if the request succeeds Additional parameters:
|