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

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

hello!

I have two problems: one being that i´m not very much into code and the other one having to re-bind the jquery lightbox selector to new content loaded into a div with a simple function.

I read the faq on re-binding and get the idea but I´m lost once it goes about a click event and what not.

here´s what I have:

in a flash menu this simple code fires a function "loadTemplate" described in a separate js-file:
  1.  getURL("javascript:loadTemplate('templates/seite"+signal+".txt','content')", "_self");
     for (i=0; i<=25; i++) {
      if (i==25) {
      getURL("javascript:lightboxneuladen()", "_self");
      }
     }




here´s the 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);
    }











I can normally bind all links on my page to the lightbox by this:

  1. $(function() {

        $('a').lightBox();

but of course, once someone clicks a button in the menu and my content gets refreshed with new code -> the binding to the lightbox is lost.

as you can see at the top I tried recalling  $('a').lightBox(); via the function "lightboxneuladen" and after a little break of 1 second, but as the new content is only existent in the browsers cache (or at least I believe that this is the problem) nothing happens.

So, either I have to make jquery see the cache or something else is going wrong, but as no-coder I´m stuck anyways.

A little help from you would be very much apreciated,

thank you!