loading json with jquery AJAX CROS enabled
by brandon_rmsy
HTML
<div id="content"></div>
JavaScript
// Loading JSON with CROS
var url = 'https://dl.dropboxusercontent.com/s/i7rvbhkh6inth9a/feed.json';
var content = "";
$.ajax({
type: 'GET',
url: url,
async: false,
contentType: "application/json",
dataType: 'json',
success: function (data) {
alert('success');
for(index in data){
for(doc in data[index]){
content += Object.keys(data[index][doc])[0] + ", ";
}
}
document.getElementById("content").innerHTML = content;
},
error: function (e) {
alert('error');
console.log(e);
}
});