简体   繁体   English

PhoneGap / Cordova 1.9.0 Windows Phone 7 AJAX不起作用

[英]PhoneGap/Cordova 1.9.0 Windows Phone 7 AJAX not working

I seem to be having a problem retrieving data via a function and have no idea why it isn't working with Windows Phone 7. The code below is what I have for iOS and Android and it works fine - note I did have to add the URL to the whitelist for iOS. 我似乎在通过函数检索数据时遇到问题,不知道为什么它不能与Windows Phone 7一起使用。下面的代码是我在iOS和Android上所拥有的,并且工作正常-请注意,我确实必须添加iOS白名单的URL。

Is there any reason that this wouldn't work on Windows Phone 7? 是否有任何理由在Windows Phone 7上不起作用? I'm using PhoneGap/Cordova 1.9.0. 我正在使用PhoneGap / Cordova 1.9.0。

            $( '#customerOverview' ).live( 'pagebeforeshow',function(){
                customerBanner();
            });         

function customerBanner() {
            $.ajax({
            url: "http://10.1.1.11:8080/WebPortal/data",
            data: {functionID:"CustomerBanner",custID:100},
            dataType: "xml",
            success: function(data){
                                    $(".customerid").html(data.getElementsByTagName("ID")[0].childNodes[0].nodeValue);
                                    $(".customerfname").html(data.getElementsByTagName("FName")[0].childNodes[0].nodeValue);
                                    $(".customerlname").html(data.getElementsByTagName("LName")[0].childNodes[0].nodeValue);

                                    var balance = data.getElementsByTagName("Balance")[0].childNodes[0].nodeValue;
                                    if(balance > 0) {
                                    $(".customerbalance").html("<font color=008000>" + balance + "</font>");
                                    } else {
                                                $(".customerbalance").html("<font color=800000>" + balance + "</font>");
                                            }
                                    }
                 });
            }

I think you will have to do a JSONP call because this is a cross domain call. 我认为您将必须进行JSONP调用,因为这是跨域调用。 I think that is how I solved those issues. 我认为这就是我解决这些问题的方式。 Of course you can do posts, puts and deletes. 当然,您可以发布,放置和删除。 Anyway I would try that first and see what happens. 无论如何,我会先尝试一下,看看会发生什么。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM