javascript - Failed to execute 'send' on 'xmlhttprequest' failed to load - Stack Overflow

Hello guys I'm getting the error mentioned in the headline when i try to a run my app created in D

Hello guys I'm getting the error mentioned in the headline when i try to a run my app created in DevExtreme.

Whenever Í run my app in the DevExtreme simulator it works as it should but when I try to run the app on my phone I get the mentioned error.

    function CallService() {
    var baseAddress = "http://192.168.80.2:8080/WebService/rest/WarehouseServices/";

    $.ajax({
        type: "GET",
        url: baseAddress + 'getPickingOrders',
        contentType: 'applicaiton/xml; charset=utf-8',
        dataType: "xml",
        async: false,
        success: function (xmlObject) {
            xml = xmlObject;
            console.log("succes ramt");
            alert(xml);
            console.log(xml);
            dataSource = GetData(xmlObject);
        },
        error: ErrorOccur
    });

}

I have been strugling with this problem for a long time now and I'm out of ideas.

Hello guys I'm getting the error mentioned in the headline when i try to a run my app created in DevExtreme.

Whenever Í run my app in the DevExtreme simulator it works as it should but when I try to run the app on my phone I get the mentioned error.

    function CallService() {
    var baseAddress = "http://192.168.80.2:8080/WebService/rest/WarehouseServices/";

    $.ajax({
        type: "GET",
        url: baseAddress + 'getPickingOrders',
        contentType: 'applicaiton/xml; charset=utf-8',
        dataType: "xml",
        async: false,
        success: function (xmlObject) {
            xml = xmlObject;
            console.log("succes ramt");
            alert(xml);
            console.log(xml);
            dataSource = GetData(xmlObject);
        },
        error: ErrorOccur
    });

}

I have been strugling with this problem for a long time now and I'm out of ideas.

Share Improve this question asked Apr 5, 2016 at 8:17 user5396725user5396725 7
  • async: false Why? Why? It makes for a horrible UX. – T.J. Crowder Commented Apr 5, 2016 at 8:21
  • We could use more context. Where is this code running? The other SO questions I see with this specific error message talk about the code being part of a Chrome extension -- is that the case here? – T.J. Crowder Commented Apr 5, 2016 at 8:23
  • The code is running in a framework called DevExtreme which also able to simulate the code as it would be a a mobile phone. I'm not sure what you mean about being a party of a Chrome extension. The app is only giving this error when running on my phone and not in the simulator – user5396725 Commented Apr 5, 2016 at 8:38
  • Re async: false: Sure it will, you just need to use the callback correctly. – T.J. Crowder Commented Apr 5, 2016 at 8:47
  • 1 Look at just about any example of using ajax. The key thing is to use the result from within the success callback, not to do it in code following the ajax call. – T.J. Crowder Commented Apr 5, 2016 at 9:12
 |  Show 2 more ments

1 Answer 1

Reset to default 1

If the page where this script is running isn't on http://192.168.80.2:8080 and your server doesn't enable Cross-Origin Resource Sharing for whatever origin it's on, you're running into the Same Origin Policy, which prohibits cross-origin ajax.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744219987a4563735.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信