我使用jQuery函數來拉入數據以填充div。我拉入的內容有CSS選擇器,應該與我寫的jQuery點擊函數相匹配。但是,當我加載數據時,雖然有正確的CSS選擇器,但當我點擊應該從jQuery調用響應的區域時,什麼都不會發生。通過jQuery AJAX插入的內容不與以前的函數關聯
我需要做某種重新加載嗎?
下面是我得到了jQuery的AJAX代碼:
$(document).ready(function() {
// AJAX functionality for drupal nodes
$(".ajax_node").click(function() {
var ajax_src = $(this).attr("href"); // we're gonna load the href
// empty target div and load in content
// the space in the string before the #id is necessary
$("#ajax_area").empty().load(ajax_src + " #ajax_wrapper");
return false; // stops the link from following through
});
// General AJAX functionality
$(".ajax").click(function() {
var ajax_src = $(this).attr("href");
$("#ajax_area").empty().load(ajax_src);
return false;
});
});