loading json with jquery AJAX CROS enabled
JavaScript
// Loading JSON with CROS
$.getJSON("http://localhost/map.json", {},
function (data) {
$.each(data.items, doSomething1);
alert('success')
});
var url = 'http://localhost/map.json';
$.ajax({
type: 'GET',
url: url,
async: false,
contentType: "application/json",
dataType: 'json',
success: function (data) {
alert(this.url);
//console.log(data);
},
error: function (e) {
alert('error');
console.log(e);
}
});