如果请求的url是静态的html页面,则需要在页面中添加meta标签代码:

<meta http-equiv="Access-Control-Allow-Origin" content="*" />

如果是PHP的话,可以用下面的代码:

header('content-type:application:json;charset=utf8');
header('Access-Control-Allow-Origin:*');
header('Access-Control-Allow-Methods:POST');
header('Access-Control-Allow-Headers:x-requested-with,content-type');

 

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注