Reputation: 1
I am trying this
$(document).ready(function() {
$("button").click(function() {
$.get('m.csv', function(result) {
$("div").html(result);
});
});
});
When the button is clicked it replaces the text on web page with the text in a csv file. It works fine for files stored on my local machine however when I replace the m.csv
with a csv file stored on web server (for example, http://www.abc.com/a.csv) it doesn't work. How can I fix this?
Upvotes: 0
Views: 742
Reputation: 382102
Your problem is that you're trying to read documents issued from another domain, an operation which is now prevented by Same origin policy. This can't work unless the server explicitly allows it by adding CORS headers.
If you can't ask the owners of the server to set the headers you need, your only solution would be to make those files appear as served by your server,
Upvotes: 1