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)
}
})
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.
—— 如果看不懂,百度翻译