Dynamic content doesn't work when loaded with ajax

Posted by Wurlitzer on Stack Overflow See other posts from Stack Overflow or by Wurlitzer
Published on 2010-04-25T09:37:36Z Indexed on 2010/04/25 9:43 UTC
Read the original article Hit count: 261

Filed under:
|
|

I'm trying to load some dynamic content after the user has logged in, using $.ajax, like so:

$.ajax({
    url: "functions.php",
    type: "GET",
    data: login_info,
    datatype: 'html',
    async: false,
    success: function (response) {
        $('#main').html(response);
    }
});

The problem is, that some events don't work, when loaded this way. I fixed the buttons with the .live() method, but a sortable list for example, doesn't work. How can I somehow refresh the DOM, and let jquery know of these new added elements?

Thanks!

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery