How can I get JSON data from this URL, access the "url" field and store it as a string. All solutions out there seem to only work on a server. i.e. running php on an apache server or something like that. When I run my code:
$(document).ready( function() {
var url = 'http://www.bing.com/HPImageArchive.aspx?format=js&idx=0&n=1&mkt=en-US';
$.get(url, function (data) {
$(data).find("url").each(function () {
var el = $(this);
console.log("------------------------");
console.log("link : " + el.find("url").text());
});
});
});
I get the error: XMLHttpRequest cannot load ... No 'Access-Control-Allow-Origin' header is present on the requested resource. Which I've research extensively but all the solutions don't work for local files. Both JSONP and CORS don't seem to work here.
EDIT: Let me try to refine this to a simpler question. Is it possible to parse a JSON object without using server-side scripting?