jviotti jviotti - 3 months ago 15x
Ajax Question

Ajax GET request over HTTPS

How can I send an ajax GET request over HTTPS?

throws this:

XMLHttpRequest cannot load https://********. Origin null is not allowed by Access-Control-Allow-Origin.

Is there another way or some workaround to get this working?

If I navigate to the url with Chrome I'm able to get the response. I see no reason why it shouldn't work work over an ajax request.


You cannot make an AJAX request to an https page if you are currently in http because of the Same Origin Policy.

The host, port and scheme (protocol) must be the same in order for the AJAX request to work.

You can either make sure that the originating page is on the same host and scheme or implement CORS (cross-origin resource sharing) on the target domain to permit this particular request.