mui.ajax('https://m.xiashutxt.com/search.html', {
data: {
searchkey: '无限恐怖',
searchtype: 'all'
},
dataType: 'html', //服务器返回json格式数据
type: 'post', //HTTP请求类型
timeout: 10000, //超时时间设置为10秒;
success: function(data) {
//服务器返回响应,根据响应结果,分析是否登录成功;
console.log(data);
},
error: function(xhr, type, errorThrown) {
//异常处理;
console.log(type);
}
});
以上代码在APP端正常,使用chrome调试时提示:
Access to XMLHttpRequest at 'https://m.xiashutxt.com/search.html' from origin 'http://127.0.0.1:8848' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
这个网站不是我的,是别人的,请问有解决办法吗?
1 个回复
tinker_li - itititit
win下chrome有跨域问题,hbuilderx没有跨域问题。
mac下chrome有跨域问题,hbuilderx也有跨域问题。
https://ask.dcloud.net.cn/question/83213 这里边有同事的截图。