Hello all,
I'm using AJAX to populate a div tag in my HTML when a drop down list item is selected. It works perfectly in Safari, Firefox, Opera, but fails in IE. The responseText just comes back blank from the php script.
Here's the Javascript it has to deal with:
function GetXmlHttpObject()
{
xmlHttp = null;
try
{
// Firefox, Opera, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
// Internet Explorer
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); // 6.0+
}
catch (e)
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); // 5.5+
}
}
}
function stateChanged()
{
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{
var response = xmlHttp.responseText;
document.getElementById("contentBox").innerHTML=response;
}
}
And here's the php script I'm using to fetch some data from the MySQL server:
<?php
$id = $_GET["id"];
include('connect.php');
$theQuery = mysql_query("select post from archive where title='" . $id . "'");
$row = mysql_fetch_assoc($theQuery);
echo $row['post'];
?>
Thanks in advance for any help!