简体   繁体   中英

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.

Is there any reason that this wouldn't work on Windows Phone 7? I'm using 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. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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