HOME HTML CSS JAVASCRIPT SQL PHP JQUERY XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

jQuery getScript() Method

jQuery AJAX Methods jQuery AJAX Methods

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:
  • response - contains the result data from the request
  • status - contains the status of the request ("success", "notmodified", "error", "timeout", or "parsererror")


jQuery AJAX Methods jQuery AJAX Methods


Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates

SHARE THIS PAGE