0

I have now spent hours trying to find a solution, I cannot GET anything from this link: https://developer.mozilla.org/en-US/search.json

My exercise (extra credit) is to GET information from that site using AJAX. In Chrome under response header it says 'Allow:GET'. That's what I have been trying to do. I understand that pre-flight is an 'OPTION' and its not supported by that link since it gives me the 405 error.

I am completely lost and the previous answer someone gave didn't work. I understand I can install a plugin to get around it. But I wanted to know if there is a way for it to work just with code. I am afraid that it wont work on someone else's computer just because they don't have that plug in.

This is the error I get:

XMLHttpRequest cannot load

https://developer.mozilla.org/en-US/search.json?q=javascript. No 'Access-Control-Allow-Origin' header is present on the requested resource.

Someone answered my question quickly and said that it was already answered but it just linked me to a tutorial that I had previously read and that didn't work for me. Once again, I know about the plug in, but is that really the only option I have? Is there something I am missing?

halfer
  • 19,824
  • 17
  • 99
  • 186
Raid55
  • 85
  • 2
  • 7
  • The code you provided is unrelated to the error you are receiving. That is to say, the problem is due to the server not returning the headers required to make this request possible. – Kevin B Dec 20 '16 at 20:49
  • 1
    What part of the error don't you understand? MDN does not allow CORS. – SLaks Dec 20 '16 at 20:49
  • A resource must explicitly allow cross-origin requests by saying so in the headers sent as a response to the preflight request. Looks like MDN does not allow them. Read: https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS – sdgluck Dec 20 '16 at 20:49

1 Answers1

0

MDN doesn't allow for CORS... Sorry for this dumb question. I will stand behind the fact that it was my first one ever... but nonetheless this was a stupid question and I now realize it.

Raid55
  • 85
  • 2
  • 7