jQuery getScript() Yöntemi

❮ jQuery AJAX Yöntemleri

Örnek

Bir AJAX isteği kullanarak bir JavaScript alın ve çalıştırın:

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

Tanım ve Kullanım

getScript() yöntemi, bir AJAX HTTP GET isteği kullanarak bir JavaScript almak ve yürütmek için kullanılır.


Sözdizimi

$(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 Yöntemleri