stuck with re-binding to jquery lightbox to ajaxed content (in cache?)

stuck with re-binding to jquery lightbox to ajaxed content (in cache?)

Hello,

I have a problem, mainly because I really am not into code and when I read the faq on re-binding I basically can´t follow as I don´t know how to get from a click event to something that fits my scenario.

which is:

I load new content into a div "content" with this simple function:
  1. function loadTemplate( template, divToLoad )
    {
        var req = new XMLHttpRequest();
        req.open('GET', template, true);
        req.onreadystatechange = function ()
        {
            if (req.readyState == 4)
            {
                document.getElementById(divToLoad).innerHTML = req.responseText;
            }
        };
        req.send(null);
    }












this function gets fired once someone clicks a button in the flash menu by this:
  1. getURL("javascript:loadTemplate('templates/seite"+signal+".txt','content')", "_self");
     for (i=0; i<=25; i++) {
      if (i==25) {
      getURL("javascript:shadowboxneuladen()", "_self");
      }
     }





so, for the jquery lightbox to work, a selector is set up in the header to apply the lightbox bind to in this case all links:
  1. $(function() {

        $('a').lightBox();
    });



easy enough so far.

but when I load in the new content code from the text files lightbox won´t be binded to any links within it, of course.

as you can see, I also tried to run the " $('a').lightBox();" again after 1 second within the function that calls the javascript to load new content. but it won´t work.

I have a theory that this is the case because the new content code is only in the browser cache and not really written to the index.html. could that be?

Can someone please help me n00b?

Thanks alot!