0

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?

1 Answer 1

1

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,

  • either by downloading them
  • or by using a proxy on your server.
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.