我正在使用.htaccess重写网址,我使用了html基本标记以使其正常工作.
现在,当我尝试发出ajax请求时,我收到以下错误:
XMLHttpRequest无法加载http://www.wordicious.com/login.php.请求的资源上不存在"Access-Control-Allow-Origin"标头.因此,不允许来源" http://wordicious.com "访问.
Jay Patel.. 170
使用addHeader
而不是使用setHeader
方法,
response.addHeader("Access-Control-Allow-Origin", "*");
*
在上面的行将允许access to all domains
.
允许access to specific domain only
:
response.addHeader("Access-Control-Allow-Origin", "http://www.example.com");
检查一下blog post
.