Chinchan Zu
Chinchan Zu

Reputation: 918

JQuery: Download function invokes XMLHttpRequest: Origin null is not allowed by Access-Control-Allow-Origin

I am trying to download a file from website/s and it just throws an error about Access-Control. can anyone teach me how to make this code work? thanks in advance

  var jqxhr = $.get("http://www.somewebsite.com/matodb.csv", function() {
    alert("success");
  })
  .success(function() { alert("second success"); })
  .error(function() { alert("error"); })
  .complete(function() { alert("complete"); });

Upvotes: 0

Views: 414

Answers (1)

PiTheNumber
PiTheNumber

Reputation: 23552

You can not make AJAX queries to other domains for security reasons (Same origin policy).

Upvotes: 1

Related Questions