本来很简单的一件事情,结果遇上了跨域。。
接触过微信开发的应该知道,获取openid的时候,有一步是这样的:
点击公众号菜单
进入h5页面获得code
(菜单链接)
,然后在请求 "https://api.weixin.qq.com/sns/oauth2/access_token"
然后,就跨域了。我设置了回调域名
提示是这样的:
XMLHttpRequest cannot load https://open.weixin.qq.com/co... No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://test.xxxx.com' is therefore not allowed access.
是你哪里配置有问题