getting web page data as json object?
- by encryptor
I have a url, the data of which page i need as a json object.
I ve tried xmlhttprequest and ajaxobject both but doesnt work. It doesnt even give a responseText when I give it as an alert
Ill post both the code snippets here. url = http://mydomain.com:port/a/b/c
AJAX :
var ajaxRequest = new ajaxObject(URL);
ajaxRequest.callback = function (responseText,responseStatus) {
alert(responseStatus);
JSONData = responseText.parseJSON();
processData(JSONData);
}
USING xmlhttprequest:
var client = new XMLHttpRequest();
client.open('GET',URL,true );
data = JSON.parse(client.responseText);
alert(data.links.length);
can someone please help me out with this. I understand cross scripting may be an issue, but how to come over it? and shouldn't then too it should give the alerts as zero or null