我正在使用ajaxSend鉤住jQuery中的ajax請求。我想要做的是確定是否使用加載方法。所以,當這調用時...檢測使用ajaxSend調用jquery ajax方法
$('.some-selector').load(url, {...});
我可以不同於常規的「$就」,「$不用彷徨」或「$。員額」呼叫處理。 有沒有一種方法可以使用傳遞的事件xhr或ajaxSend調用中的選項來解決這個問題?
$(document).ajaxSend(function (event, xhr, options) {
//Do something here to figure out if 'load' method was used
//And also determine what element(s) it was called against
});
如果有任何方法可以說,我會感到驚訝,因爲'.load'只是內部調用'.ajax'。快速瀏覽一下'load'的來源並沒有提供任何識別信息。 –