mbarandao 0 Junior Poster

Hello:

I have an ajax file to loads the content of another file into a div, here is the js code:

<script type="text/javascript">
    function showUser(str)
{
if (str=="")
  {
  document.getElementById("txtHint").innerHTML="";
  return;
  } 
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","getcar.php?q="+str,true);
xmlhttp.send();
}
</script>

the file within xmlhttp (getcar.php) has other js codes that are to be executed once the file is loaded into the div. here is one of those files:

<!-- loading, please wait message script begins-->
<div id=\"loading\" class=\"loading-invisible\" z-index: 999>
  <p><font color=\"black\" size='4'>one moment, please!</font> <font color=#218868> Auto Tech Pro &nbsp;&laquo;&nbsp;Initiating...&nbsp;&raquo;&nbsp;</font><br /><img border='0' src='images/spinnnnnn.gif' width='215px' height='206px'>

</div>
<script type=\"text/javascript\">
  document.getElementById(\"loading\").className = \"loading-visible\";
  var hideDiv = function(){document.getElementById(\"loading\").className = \"loading-invisible\";};
  var oldLoad = window.onload;
  var newLoad = oldLoad ? function(){hideDiv.call(this);oldLoad.call(this);} : hideDiv;
  window.onload = newLoad;

</script>

<!-- loading, please wait message script ends-->

<script type=\"text/javascript\" src=\"http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js\"></script>
      <script src=\"/AJAX/popBox1.2.0.js\" type=\"text/javascript\"></script>
    <link href=\"/AJAX/popBox1.2.0.css\" rel=\"stylesheet\" type=\"text/css\" />

    <script type=\"text/javascript\">

        $(document).ready(function () {
                $('#inputbox').popBox({width:550, newlineString: '<br/>' });
                  });     
    </script>

this however is not working. If I open getcar.php independently of the ajax, the preceeding js codes work fine, but not once the ajax loads the file into div.

Any thoughts on how this is doable?

Mossa