I have a login link on a non-secure page that triggers a JSON post using jQuery. The post goes to the same domain but using a secure URL. My understanding of JSON is that it does allow cross-domain actions like this, but maybe this is a limitation.
When I run the script I get the following javascript error:
XMLHttpRequest cannot load https://.... Origin http://.... is not allowed by Access-Control-Allow-Origin.
I'm using the following code, nothing too complicated:
// postURL is something like https://example...
// postData is data to be transmitted
$.getJSON( postURL, postData + "&json=1", function(data) {
// no error checking yet, just proceed to resultURL
if ( true ) { window.location = resultURL; }
});
I've verified that if I load my source page securely the post works perfectly, so the only problem is the https difference.
There are a half dozen or so similar questions to mine on SO but none have an answer that works in my situation. Maybe this is just a limitation that can't be worked around?
https://with//to make it a protocol-relative request.