jQuery getScript()เมธอด
ตัวอย่าง
รับและเรียกใช้ JavaScript โดยใช้คำขอ AJAX:
$("button").click(function(){
$.getScript("demo_ajax_script.js");
});
ความหมายและการใช้งาน
เมธอด getScript() ใช้สำหรับรับและรัน JavaScript โดยใช้คำขอ AJAX HTTP GET
ไวยากรณ์
$(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:
|