Reputation: 4582
So the problem is i keep getting this error. Its very intermittent and is looking some what like a Loch Ness Monster bug. Since it is never been seen on my system i just have the error report i checked stack overflow. Only 2 questions exist like mine but with no answers. So here is the code.
$(function() {
$.get("http://mysite.com/menu/popoutmenu1.php", {}, function(response) {
$("body").append(response);
})
})
When that code is executed (obviously not an exact replica of the code i am using) i get this error.
XMLHttpRequest cannot load http://www.mysite.com/menu/popoutmenu1.php.
Origin http://mysite.com is not allowed by Access-Control-Allow-Origin.
Now this works perfectly fine on my computer, but on my friends computer (its on some website) is getting the same error! I have tried SEVERAL computers and all of them work. I am very confused on this.
If anyone has any suggestions that would be great, thanks.
Upvotes: 1
Views: 1463
Reputation: 7134
Use a relative or root relative URL (path only, without hostname):
$(function() {
$.get("/menu/popoutmenu1.php", {}, function(response) {
$("body").append(response);
})
})
Self enforced SOP compliance, if you can't do it that way you'll have SOP issues.
It looks like it may be an issue with hostname forwarding. But either way this will address it.
Upvotes: 2