Content pulled in via jQuery AJAX is not associating with previous functions
- by Jarsen
I'm using the jquery .load() function to pull in data to populate a div with. The content I'm pulling in has CSS selectors that should match up with jQuery click functions I've written. However, when I load in the data, although the correct CSS selectors are there, when I click on areas that should invoke a response from jQuery, nothing happens.
Do I need to do some sort of reload?
Here's the code I've got for the 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 fucntionality
$(".ajax").click(function() {
var ajax_src = $(this).attr("href");
$("#ajax_area").empty().load(ajax_src);
return false;
});
});