Results 1 to 2 of 2

Thread: Invoking LightBox via AJAX after page has been loaded

  1. #1
    Join Date
    Aug 2009
    Location
    Colombia, South America
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Invoking LightBox via AJAX after page has been loaded

    How can I envoke the lightbox 2.04 pop up and load it with my AJAX reponse once the user clicks, calling my AJAX script?

    This after the page has already been loaded.

    Code:
     <td rel="lightbox" class="sized2" 
         onClick="ajaxFunction('594512','2009-07-27','XYZ','1','011');"
    Javascript ajaxFunction calls Websphere Servlet via AJAX

    Code:
    function ajaxFunction(_id, _timestamp, _srcProgId, _tableSeries, _pstAcctNum) {
    
    
      if(xmlhttp) { 
        xmlhttp.open("POST","ajaxServlet",true); 
        xmlhttp.onreadystatechange  = handleServerResponse;
        xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
        xmlhttp.send("ajaxCommand=" + "ajaxDetails" + "&id=" + _id + "&timestamp=" + _timestamp +....); 
    
      }
    }

    To which I get back from the AJAX call some beautiful HTML (sorry no Image - boring I know..)

    Code:
    function handleServerResponse() {
       if (xmlhttp.readyState == 4) {
         if(xmlhttp.status == 200) {
            document.getElementById("dog").innerHTML=xmlhttp.responseText; 
    .
    Which I was setting in a div tag "dog". I am in need of presenting this xmlhttp.responseText as a pop up in the lightbox that has not yet been invoked and the entire page has been previously loaded.

    I have everything installed, js, css and the like and I have the demo pasted into this very page and it works fine - with that demo image, but that image was there when the page loads.

    How can I envoke the lightbox to pop up and be loaded with the AJAX response once the user OnClick() calls my AJAX script?

    There has to be a way to do this with lightBox 2.04

    I appreciate any insight and I have searched this forum, there are two similar topics but the tie in is not really illustrated. Thanks in advance

  2. #2
    Join Date
    Aug 2009
    Location
    Colombia, South America
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I am posting incomplete code becasue, well it is incomplete. The problem is not the code not working rather the code not coded.

    I get the AJAX response back and I get the LightBox to pop up it's demo image. I just need to tie AJAX reponse to make the LightBox appear for the onClick() Sorry!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •