getting web page data as json object?
Posted
by encryptor
on Stack Overflow
See other posts from Stack Overflow
or by encryptor
Published on 2010-04-22T07:33:58Z
Indexed on
2010/04/26
11:03 UTC
Read the original article
Hit count: 274
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
© Stack Overflow or respective owner