طريقة jQuery ajaxSend ()

❮ طرق jQuery AJAX

مثال

غيّر محتوى عنصر <div> عندما تكون طلبات AJAX على وشك الإرسال:

$(document).ajaxSend(function(e, xhr, opt){
  $("div").append("<p>Requesting: " + opt.url + "</p>");
});

التعريف والاستخدام

تحدد طريقة ajaxSend () وظيفة يتم تشغيلها عند اقتراب إرسال طلبات AJAX.

ملاحظة: اعتبارًا من الإصدار 1.8 من jQuery ، يجب إرفاق هذه الطريقة بالمستند فقط.


بناء الجملة

$(document).ajaxSend(function(event,xhr,options))

Parameter Description
function(event,xhr,options) Required. Specifies the function to run if the request succeeds
Additional parameters:
  • event - contains the event object
  • xhr - contains the XMLHttpRequest object
  • options - contains the options used in the AJAX request

❮ طرق jQuery AJAX