首页 新闻 赞助 找找看

mui请求访问接口报错

0
悬赏园豆:5 [待解决问题]

XMLHttpRequest cannot load http://192.168.0.103:8080/setCookie. Response to preflight request doesn't pass access control check: The 'Access-Control-Allow-Origin' header has a value 'http://192.168.0.103' that is not equal to the supplied origin. Origin 'null' is therefore not allowed access.
采用mui.ajax访问后台数据接口,报如上错误!访问的时候,状态码一直保持在200,

不知道怎么解决,求助。在这里先谢谢了!
访问代码如下:
mui.ajax('http://192.168.0.103:8080/setCookie',{
dataType:'json',//服务器返回json格式数据
type:'post',
timeout:10000,
headers:{'Access-Control-Allow-Origin':"*",'Content-Type':'application/json'},
crossDomain: true,
success:function(data){
console.log(data)
},
err:function(xhr,type,errorThrown){
console.log(type)
}
})

web新人类的主页 web新人类 | 初学一级 | 园豆:197
提问于:2019-09-21 20:41
< >
分享
所有回答(1)
0

The 'Access-Control-Allow-Origin' header has a value 'http://192.168.0.103' that is not equal to the supplied origin. Origin 'null' is therefore not allowed access.

—— 如果看不懂,百度翻译

花飘水流兮 | 园豆:13560 (专家六级) | 2019-09-21 22:42
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册