Quantcast
Channel: CNode:Node.js专业中文社区
Viewing all articles
Browse latest Browse all 14821

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

$
0
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发送跨域请求,请赐教!


Viewing all articles
Browse latest Browse all 14821

Trending Articles