On Feb 5, 9:55 pm, frizzle <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I'm using Klaus' History/Remote plugin for Jquery.
> I have the JS included, and the script looks like this:
>
>   <script type="text/javascript">
>     $(function() {
>       $('a.remote').remote('#files', function() {
>         if (window.console && window.console.info) {
>           console.info('content loaded');
>         }
>       });
>       $.ajaxHistory.initialize();
>     });
>   </script>
>
> So the new content is displayed in the <div id="files"></div> which
> works quite alright,
> but once i've fired new content into that div, and that content has
> new links with the class="remote" attribute, they don't work anymore.
> I reckon that has something to do with the links not being
> "indexed"already, but my knowledge in JS is very little, so please
> bear with me....
> How could I solve this?
>
> Thanks,
> Frizzle.

Your assumption is right. By the time you enabled history for the
links, the Ajax content that gets loaded later on isn't part of the
DOM. You need to initialize again in the callback after the content
has been loaded. I suggest  using a recursive function. Untested:

$(function() {

    function remote(target, context) {
        context = context || document;
        $('a.remote', context).remote(target, function()  {
            remote(target, '#files');
        });
    }
    remote( $('#files') );
    $.ajaxHistory.initialize();

});


--Klaus

Reply via email to