IT博客汇
  • 首页
  • 精华
  • 技术
  • 设计
  • 资讯
  • 扯淡
  • 权利声明
  • 登录 注册

    Vue中如何使用axios发送jsonp跨域验证

    justbecoder发表于 2017-06-01 16:38:39
    love 0
    1. 在使用axios发送请求时,服务器端设置 res.header(“Access-Control-Allow-Origin”, “*”);可以正确得到结果

    2. 当服务器端不设置允许跨域时,使用jsonp方式发送就不行了,提示错误如下

      XMLHttpRequest cannot load http://localhost:3000/axios?cb=cb. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.
      

    那个小伙伴在Vue中使用axios发送跨域请求,请赐教!



沪ICP备19023445号-2号
友情链接