Jquery AJAX and figuring out how NOT to nest callbacks for multiple reloads.
        Posted  
        
            by David H
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by David H
        
        
        
        Published on 2010-04-18T15:19:51Z
        Indexed on 
            2010/04/18
            15:23 UTC
        
        
        Read the original article
        Hit count: 461
        
I have a site with a few containers that need to load content dynamically via AJAX.
Most of the links inside of the containers actually load new data in that same container.
I.E: $("#navmenu_item1").click(function() { $("#navmenu").load(blah); });
When I click on a link, lets say "logout," and the menu reloads with the updated login status, none of the links now work because I would need to add a new .click into the callback code.
Now with repeated clicks and AJAX requests I am not sure how to move forward from here, as I am sure nested callbacks are not optimal.
What would be the best way to do this?
Do I include the .click event inside the actual AJAX file being pulled from the server, instead of within index.php? Or can I somehow reload the DOM?
Thanks for the help!
© Stack Overflow or respective owner