I have an HTML page with JavaScript on our main domain (www.mysite.com) and an ASP page on another domain (xyz.mysite.com).
GET code:
req.open('get', url, true);
req.send('');
POST code:
req.open('post', url, true);
req.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
req.send(data);
When I perform a GET request the page is successfully called. However, when I perform a POST request I get this error:
XMLHttpRequest cannot load http://xyz.mysite.com/server-page.aspx. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://www.mysite.com' is therefore not allowed access.
So I added the following to my ASP page on xyz.myspace.com, but still no luck:
Response.AppendHeader("Access-Control-Allow-Origin", "*");
Any ideas? Thanks!