I have an Ajax script which works fine in IE. However, it only works in Firefox up until the responseText is obtained, and then Firefox just ignores the rest of the script. It won't even perform a simple "alert('Done!')" statement. The Firebug console shows the correct responseText without fail, but I can't seem to do anything with it.
Here are the relevant portions of code:
The <head> Script:
<script type="text/javascript">
function getObj()
{
if (window.ActiveXObject)
return new ActiveXObject('Microsoft.XMLHTTP');
else if (window.XMLHttpRequest)
return new XMLHttpRequest();
else
{
alert('Your browser does not support AJAX.');
return null;
}
}
// Update status timestamp...
function updateStatus(fname)
{
var ajaxObj = getObj();
if (ajaxObj != null)
{
url = 'updstat.php?wid=<?php echo $wo_id ?>&f=' + fname;
ajaxObj.open('get', url, false);
ajaxObj.onreadystatechange = function doThis()
{
if(ajaxObj.readyState == 4 || ajaxObj.readyState == 'complete')
{
// Firefox dies at this point!!!
mytxt = ajaxObj.responseText;
alert('Done!');
document.form1.in_route.value = mytxt;
}
}
ajaxObj.send(null);
}
else
alert("Ajax is null!");
}
</script>
The PHP (simplified for troubleshooting):
<?php
echo "Hello!";
?>
The HTML:
<input type="button" value="In Route"
onclick="updateStatus('in_route');" style="width: 120px;" />
<input type="text" name="in_route" id="in_route" size="15"
readonly="readonly" value="<?php echo $in_route ?>" />
Any ideas?