jQuery ajaxStart()เมธอด
ตัวอย่าง
แสดงภาพตัวบ่งชี้ "กำลังโหลด" เมื่อคำขอ AJAX เริ่มต้น:
$(document).ajaxStart(function(){
$(this).html("<img src='demo_wait.gif'>");
});
ความหมายและการใช้งาน
ajaxStart() วิธีการระบุฟังก์ชันที่จะเรียกใช้เมื่อคำขอ AJAX เริ่มต้นขึ้น
หมายเหตุ:สำหรับ jQuery เวอร์ชัน 1.8 วิธีนี้ควรแนบมากับเอกสารเท่านั้น
ไวยากรณ์
$(document).ajaxStart(function())
Parameter | Description |
---|---|
function() | Required. Specifies the function to run when the AJAX request starts |