niladhar
03-24-2010, 05:01 PM
I am tryin to get data through json on the fly and display it on the browser, although i get the content coded perfectly in json it doesnt parse it and display it.
if (xmlhttp.readyState==4)
{
alert(xmlhttp.responseText);
var theResponse = JSON.parse(xmlHttp.responseText);
document.getElementById('task_area').innerHTML = theResponse.firstResponse;
document.getElementById('active_area').innerHTML = theResponse.secondResponse;
}
The alert shows me
{"firstResponse":"hello world","secondResponse":"hello america"}
Thus i have the responsetext formatted correctly in json but i gues it just doesnt parse it.... any help.... i have json2.js (json lib) including in the same html file as i have this javascript file included in.
if (xmlhttp.readyState==4)
{
alert(xmlhttp.responseText);
var theResponse = JSON.parse(xmlHttp.responseText);
document.getElementById('task_area').innerHTML = theResponse.firstResponse;
document.getElementById('active_area').innerHTML = theResponse.secondResponse;
}
The alert shows me
{"firstResponse":"hello world","secondResponse":"hello america"}
Thus i have the responsetext formatted correctly in json but i gues it just doesnt parse it.... any help.... i have json2.js (json lib) including in the same html file as i have this javascript file included in.