I am completely new to this so please bear with me here. My project involves a webpage executing php scripts via an xmlhttprequest which queries a database and returns data to the webpage. This code below is working to a degree in IE7. As I have not yet parsed http.responseText, I am getting all the code in parts.php in the alert. My php script query creates two php arrays, one a single array and a two-dimensional array such as array[][]. My first question is how can I extract these arrays from http.responseText so I can display them. My 2nd is, stepping through the code in tomcat v5.0.28, the script executes the first alert showing http.readyState = 1, but then stops/fails even with the firewall disabled. Looking at the code below, can anyone suggest a possible reason why? Any help appreciated.
RPJD :)
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" dir="ltr" lang="en">
-
<head>
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-
<script language="JavaScript">
-
function Parts()
-
{
-
var url="http://localhost:8080/Databases/parts.php";
-
if(window.XMLHttpRequest)
-
http = new XMLHttpRequest();
-
else if (window.ActiveXObject)
-
http = new ActiveXObject(Microsoft.XMLHTTP);
-
http.onreadystatechange = function()
-
{
-
alert(http.readyState);
-
if(http.readyState == 4)
-
{
-
alert(http.status);
-
if(http.status == 200)
-
{
-
result = http.responseText;
-
alert(result);
-
}
-
else
-
{
-
// + " " + http.statusText;
-
}
-
}
-
}
-
http.open("GET", url, true);
-
http.setRequestHeader("text/xml");
-
http.send(null);
-
}
-
</script>
-
</head>
-
<body>
-
<FORM name="description" method="POST" action="">
-
<p>
-
<INPUT type="BUTTON" value="Parts" ONCLICK="Parts();">
-
</p>
-
<p>
-
-
</body>
-
</html>
-