ajaxグローバルイベントフック
// $("body") という例をよく見かけるが、何故か出力されないので注意 $(document) .bind("ajaxStart", function(){ console.log("ajaxStart"); }) .bind("ajaxSend", function(){ console.log("ajaxSend"); }) .bind("ajaxSuccess", function(){ console.log("ajaxSuccess"); }) .bind("ajaxError", function(){ console.log("ajaxError"); }) .bind("ajaxComplete", function(){ console.log("ajaxComplete"); }) .bind("ajaxStop", function(){ console.log("ajaxStop"); }) ; $.ajax("a.html"); // 以下の順番でコンソールに出力される(エラーは発生しないので、ajaxErrorは出ない) /* ajaxStart ajaxSend a.html へのアクセス ajaxSuccess ajaxComplete ajaxStop */