I had to do this test, but I think my solution could be more strong. Could you please help me?

the original javascript.html file :

<html>
<head>
<title></title>
</head>

<script>
function GetData(){
alert( "Please review instructions within the GetData method" );

//Define a new object type "Request" that is responsible for retriving data from the server
var request = new Request("data.txt");
//It should have a Public method called "GET"
request.GET();
//And a Public property called "Response"
var response = request.Response;

//Implement the "Convert" method below so that it will convert JSON text into a javascript Object
var jsonObject = Convert(response);

//Define a new "Table" object that initializes from the Json object above,
var table = new Table(jsonObject);
//and has a "ToHtml" method that will return a HTML string representation of the table data
var html = table.ToHtml();

//Implement the SetDivInnerHtml that will locate a named div by Id
//and sets the InnerHtml to the passed value
SetDivInnerHtml("ServerData", html);
}

function Convert(jsonText){
//TBD
}

function SetDivInnerHtml(id, html){
//TBD
}

</script>

<body>

<input type="button" id="GetData" name="GetData" value="Get data from server" onclick="GetData()"/>

<div id="ServerData"></div>

</body>
</html>

the data.txt file (JSON) :

{
"table": {
"rows" : [
{"columns" : ["Title", "Author", "Publisher"]},
{"columns" : ["Programming Microsoft ASP.NET", "Dino Esposito", "MSPress"]},
{"columns" : ["XML Application Development with MSXML 4.0", "Dino Esposito", "Publisher"]},
{"columns" : ["JavaScript &amp; DHTML Cookbook", "Danny Goodman", "OR"]},
{"columns" : ["avaScript: The Definitive Guide", "David Flanagan", "OR"]}
]
}
}


My solution :

<html>
<head>
<title></title>

<script>

function Request(dataText) {
//this.Response = "yo";
this.get = function () {
var http_request = null, userBrowser = navigator.userAgent.toUpperCase();
if(typeof(XMLHttpRequest) === "function" || typeof(XMLHttpRequest) === "object")
http_request = new XMLHttpRequest();
else if(window.ActiveXObject && userBrowser.indexOf("MSIE 4") < 0) {
if(userBrowser.indexOf("MSIE 5") < 0)
http_request = new ActiveXObject("Msxml2.XMLHTTP");
else
http_request = new ActiveXObject("Microsoft.XMLHTTP");
}
http_request.open( "GET", dataText, true );
http_request.onreadystatechange = function () {
if ( http_request.readyState == 4 ) {
if ( http_request.status == 200 ) {
Request.prototype.Response = http_request.responseText;
//alert( "Request.prototype.Response = " + Request.prototype.Response );
} else {
alert( "There was a problem with the URL." );
}
}
}; //onreadystatechange
http_request.send(null);
}; // this.get

}


function Table(jsonObject) {
this.ToHtml = function () {
var table = '';
table = '<table>';
for(i = 0; i < jsonObject.table.rows.length; i++) {
table += '<tr>';
var col_string=jsonObject.table.rows[i].columns.toString();
var col_array=col_string.split(",");
var part_num=0;
while (part_num < col_array.length)
{
table += '<td>' + col_array[part_num] + '</td>';
part_num+=1;
}
table += '</tr>';
} // rows
table += '</table>';
return table;
};
}

function GetData(){
//There was a problem with GetData, I use GetData1
}

function GetData1(){
//alert( "Please review instructions within the GetData method" );
//Define a new object type "Request" that is responsible for retriving data from the server
var request = new Request("data.txt");
//It should have a Public method called "GET"
request.get();
//And a Public property called "Response"
var response = request.Response;
alert( "response =" + response );
//Implement the "Convert" method below so that it will convert JSON text into a javascript Object
var jsonObject = Convert(response);
//Define a new "Table" object that initializes from the Json object above,
var table = new Table(jsonObject);
//and has a "ToHtml" method that will return a HTML string representation of the table data
var html = table.ToHtml();
//Implement the SetDivInnerHtml that will locate a named div by Id
//and sets the InnerHtml to the passed value
SetDivInnerHtml("ServerData", html);
}

function Convert(jsonText){
//TBD
return eval('(' + jsonText + ')');
}

function SetDivInnerHtml(id, html){
//TBD
var elemento;
if(document.getElementById)
elemento = document.getElementById(id);
else
elemento = document.all[id];
elemento.innerHTML = html;
}

</script>
</head>

<body>
<form>
<input type="button" id="GetData" name="GetData" value="Get data from server" OnClick="GetData1();">
</form>
<div id="ServerData"></div>

</body>
</html>

Thank you very much. Tancrede.