铅笔的未来
铅笔的未来
  • 发布:2016-09-03 15:17
  • 更新:2016-09-03 20:58
  • 阅读:1825

mui ajax 跨域请求数据出错

分类:HTML5+
mui
  mui.ajax({  
      url: 'http://182.168.1.116/MyBloyWeb/WebServers/WebServices.asmx/Login',  
      data: {   
        UserNames:’qyuser’,  
        Passwords:’123456’  
      },  
      async: true,  
      dataType: 'json',  
      type: 'post',  
      timeout: 10000,  
      success: function(data) {  
    // 请求成功  
    var data = JSON.stringify(data);  
        alert(data.description);  
},  
error: function(xhr, type, errorThrown) {  
    // 请求失败  
     alert(type.message);  
        console.log(type+"; xhr:"+xhr.responseText);  
        mui.toast("未响应后台返回的数据!", "错误提示", "确定", null);  
}  

});

请求数据是一直报
timeout; xhr: at js/app.js:39
timeout; xhr: at js/app.js:39
timeout; xhr: at js/app.js:39
这个错误, 请问这是个什么问题?
谢谢各位大神指导。

2016-09-03 15:17 负责人:无 分享
已邀请:
蓝亭书序

蓝亭书序

首先你可以检查你的地址在浏览器是否通 http://182.168.1.116/MyBloyWeb/WebServers/WebServices.asmx/Login

然后,检查你的参数是否正确,上面的错误不是跨域错误,更像是连接不上导致超时的错误

Trust

Trust - 少说废话

补充楼上,timeout这个错误类型是指请求超时了。可以现在本地测试接口是否可以正常调用,另外检测下移动设备的网络情况。

铅笔的未来

铅笔的未来 (作者)

谢谢各位,这个问题已经解决了

  • 8***@qq.com

    问下怎么解决的呢?

    2018-03-16 16:41

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