Access-Control-Allow-Origin (AJAX & XML)

  • 1
  • Question
  • Updated 6 years ago
Using AJAX Get, and receive the error:
MLHttpRequest cannot load... is not allowed by Access-Control-Allow-Origin

I'm trying to load the file. And before you say it, the answer is "No, I do not want to use JSON".
Photo of jbriano

jbriano

  • 2 Posts
  • 0 Reply Likes

Posted 6 years ago

  • 1
Photo of Brendan Hayes

Brendan Hayes, Official Rep

  • 962 Posts
  • 122 Reply Likes
Asking around the developers here, we haven't heard of that error yet. Keeping using XML, that's totally fine!
Photo of Brendan Hayes

Brendan Hayes, Official Rep

  • 962 Posts
  • 122 Reply Likes
I'd like to know which API, in particular, you're trying to access (eg. autocomplete, etc) and if you're specifying a language in the AJAX .get() call? A code-snipped from the line(s) that are giving you the issue would also be super helpful!
Photo of GianCarlo

GianCarlo

  • 4 Posts
  • 0 Reply Likes
Hi, are you using javascript only? if so, it is not possible to pull xml data from a different domain . If you don't want to use json (jQuery can get and parse REST json services easily) you'll have to create an Http Proxy. In Java this is rather simple, you'll need a simple servlet (tons of examples). Or wait, just found that http://james.padolsey.com/javascript/... (tested only in chrome in this moment, don't know if it works for all browsers)