I want to access a JSON file which is in domain1 (example.com) from domain2 (example2.com). For example,
$.ajax({
type:'get',
url: 'http://example.com/vigneshmoha.json',
success: function(data) {
console.log(data);
},
statusCode: {
404: function() {
console.log('Status code: 404');
}
}
});
I want to make this ajax request to example.com from some other domain (ie) example2.com.
I have tried JSONP. I couldn't understand how it works. Can someone please explain the way its work?