So I have this website that has JSON object and trying to have it as an object.
As most people do once it comes to javascript problem, I took a look into jQuery and found out about awesome function called .getJSON(). (Example is below, and one can replace file name with URL)
$.getJSON('ajax/test.json', function(data) {
var items = [];
$.each(data, function(key, val) {
items.push('<li id="' + key + '">' + val + '</li>');
});
$('<ul/>', {
'class': 'my-new-list',
html: items.join('')
}).appendTo('body');
});
Which is not that hard to figure out... But problem is, below statement.
- Due to browser security restrictions, most "Ajax" requests are subject to the same origin policy; the request can not successfully retrieve data from a different domain, subdomain, or protocol.
Considering my page and the source page is not from same source, above method is not a possible option for me.
Is there any other way to solve this problem?
Thank you in advance.