Tylerliuyang
Tylerliuyang
  • 发布:2020-04-22 09:32
  • 更新:2020-04-22 10:45
  • 阅读:466

mui.ajax内置浏览器可以正常网络请求,360和其他浏览器不可以

分类:MUI

var url = "http://192.168.0.253/api/account/login?user=admin&password=test@253";
mui.ajax(url,{
dataType:'json',//服务器返回json格式数据
type:'post',//HTTP请求类型
timeout:10000,//超时时间设置为10秒;
headers:{'Content-Type':'application/json'},
success:function(data){
//服务器返回响应,根据响应结果,分析是否登录成功;
console.log(data);
},
error:function(xhr,type,errorThrown){
//异常处理;
console.log(type);
}
});

2020-04-22 09:32 负责人:无 分享
已邀请:
x***@qq.com

x***@qq.com - 疑问?的小纳?

不可以正常请求提示什么。是不是跨域问题

  • Tylerliuyang (作者)

    应该不是跨域的问题

    用下面这种方式可以正常的网络请求

    var xhr = new XMLHttpRequest();

    xhr.open("post", url);

    xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");

    xhr.send();

    xhr.onreadystatechange = function() {

    }

    2020-04-22 11:12

该问题目前已经被锁定, 无法添加新回复