views:

1240

answers:

1

This is the Main page where I am calling a light box link using ajax submit. But I am not getting the light box effect after ajax responce..

index.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html>
    <head>
     <title>Doubt</title>

     <!-- CSS for Light Box -->
     <link rel="stylesheet" href="css/lightbox.css" media="screen,projection" type="text/css" />

     <!-- Script  for Light Box Effect -->
     <script type="text/javascript" src="scriptaculous/lib/prototype.js"></script>
     <script type="text/javascript" src="scriptaculous/src/scriptaculous.js"></script>
     <script type="text/javascript" src="scriptaculous/src/lightbox.js"></script>

     <!-- Ajax Coding for submit Responce -->
     <script type="text/javascript" src="scripts/test.js"></script>

    </head>

    <body>
     <center>
      <br />
      <br />
      <br />

      <!-- Form Starts Here -->
      <form id="datas1">
       NAME:<input type="text" name="test" id="test"/><input type="button"  value="TEST" onclick="send()"  />
      </form>
      <!-- Form End Here -->


      <!--Ajax Responce Get here Start-->
      <div id="datas" style="border:solid #0000FF; width:100px; height:100px;">
       <a href="text.html" class="lbOn">Click here 1</a>
      </div>
      <!--Ajax Responce Get here End-->

      <a href="text.html" class="lbOn">Click here2</a>

     </center>
    </body>
</html>

test.php

<?php

echo $_GET['test_value'];

?>
<br />
<a href="text.html" class="lbOn">Click here1</a>

test.js

// JavaScript Document
var xmlHttp

function send()
{ 
xmlHttp=GetXmlHttpObject()
    if (xmlHttp==null)
     {
     alert ("Browser does not support HTTP Request")
     return
     }
var url="ajax/test.php"

var id = document.getElementById('test').value;
var div = document.getElementById('datas1').value;
url=url +'?test_value='+escape(id)+'&div='+ escape(div)

xmlHttp.onreadystatechange=function ()
          {
           stageChanged2();
          };


xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}


function stageChanged2() 
    { 

    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
      { 
      document.getElementById('datas').innerHTML=xmlHttp.responseText 
      } 

    }



function GetXmlHttpObject()
    {
     var xmlHttp=null;
      try
       {
       // Firefox, Opera 8.0+, Safari
       xmlHttp=new XMLHttpRequest();
       }
      catch (e)
      {
      //Internet Explorer
      try
       {
       xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
       }
      catch (e)
       {
       xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
       }
      }
     return xmlHttp;
    }
A: 

Hai

i got out pt for my issue,with help of my friend. in "test.js" after the "stageChanged2();" function we need to call the light box effect "initialize()" funtion. this function is used to initialize the light box effect once again....


xmlHttp.onreadystatechange=function () { stageChanged2(); initialize(); };


Regards

Thiyagarajan.G