So, here is the issue:
I am trying to handle some edits within a PHP file that is being passed an ID field. The PHP file is successfully building the HTML page and displaying it, but portions of the embedded javascript call are not working.
If I comment out the call to echo ' xmlhttp.onreadystatechange=function(){'; I receive all ALerts.
As soon as I uncomment the xmlhttp.onreadystatechange=function() block, nothing works.
Any help would be appreciated - below is the full code block:
echo '<script type="text/javascript">';
echo 'function populateRoomDropDown(building)';
echo '{';
echo ' alert("Started...");';
echo ' if(window.XMLHttpRequest){';
echo ' xmlhttp = new XMLHttpRequest();';
echo ' alert("Building ID: "+building);';
echo ' }';
echo ' else{';
echo ' xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");';
echo ' alert("IE Browser");';
echo ' }';
echo ' xmlhttp.onreadystatechange=function(){';
echo ' alert("Inside onready...()");';
echo ' if (xmlhttp.readyState==4 && xmlhttp.status==200){';
echo ' alert("Inside onready...()");';
echo ' document.getElementById("displayRooms").innerHTML=xmlhttp.responseText;';
echo ' }';
echo ' }';
echo ' alert("Near end...");';
echo ' xmlhttp.open("GET","../db_queries/getRoomsDropDown.php?buildingID="+building,true);';
echo ' xmlhttp.send();';
echo ' alert("End...");';
echo '}';
echo '</script>';