Can anyone see whats the problem with this code?
HTML Code:
<script type="text/javascript">
var xmlHttp;
function stateChanged() {
if (xmlHttp.readyState==4) {
document.getElementById("mysql_check").innerHTML=xmlHttp.responseText;
}
}
function getXmlHttpObject() {
var xmlHttp = null;
if (window.ActiveXObject) {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
} else if (window.XMLHttpRequest) {
xmlHttp = new XMLHttpRequest();
}
return xmlHttp;
}
function mysqlReset() {
document.getElementById("mysql_check").innerHTML = "<input type=\"button\" value=\"Check Connection\" onClick=\"mysqlCheck()\">"
}
function mysqlCheck() {
document.getElementById("mysql_check").innerHTML = "Checking...";
var host = document.getElementById("mysql_host").value;
var user = document.getElementById("mysql_user").value;
var pass = document.getElementById("mysql_pass").value;
var db = document.getElementById("mysql_db").value;
if (host.length==0 || user.length==0 || pass.length==0 || db.length==0) {
alert("Please fill in all fields");
mysqlReset();
return;
}
xmlHttp = getXmlHttpObject;
if (xmlHttp==null) {
alert("Your browser doesn't suppert AJAX which is needed to check your connection");
mysqlReset();
return;
}
var url = "http://www.stuff4web.co.uk/SCMS/admin_check_mysql.php?h="+host+"&u="+user+"&p="+pass+"&d="+db+"&s="+Math.random()*10;
xmlHttp.onreadystatechange = stateChanged;
xmlHttp.open("GET",url,true); // LINE 74
xmlHttp.send(null);
}
</script>
I am getting the error "Object doesn't support this property or method" on line 74 (maked above)