Content pulled in via jQuery AJAX is not associating with previous functions
        Posted  
        
            by Jarsen
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Jarsen
        
        
        
        Published on 2010-05-11T17:04:46Z
        Indexed on 
            2010/05/11
            17:14 UTC
        
        
        Read the original article
        Hit count: 303
        
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;
});
});
© Stack Overflow or respective owner