Software Archive
Read-only legacy content
17060 Discussions

Cross Domain AJAX call in HTML hybrid application for native plateform.

Amar_Deep_S_
Novice
1,132 Views

Hi I am building an app , which calls the google api to load some data from google. I am making an ajax request using the jquery $ajax() method. Below is the call i am making. 

function loadPlayList() {
       $.ajax({
        "method": "GET",
        "url": "https://www.googleapis.com/youtube/v3/playlistItems",
        "data": {
            "maxResults": 5,
            "part": "snippet",
            "playlistId": "MY_PLAY_LIST_ID",
            "key": "MY_KEY"
        },
        error: function (jqXHR, textStatus, errorThrown) {
            alert(' Error =textStatus=' + textStatus + ' errorThrown=' + errorThrown);
        },
        success: function (response) {
      
            $.each(response.items, function (index, tile) {                     
              //DO PROCESSING
            });
        }

    });

}

 


This application is working fine in the emulator and i tested this in app preview on iPhone and Android devices, but it is failing on the windows 8 platform in app preview.  I created a build also for the android and install the build on the android device and it is not working on native android as well.
I included all the permissions for the android and also set the * and *.google.com , *.youtube.com domains in the XDK , i cross verified these domains in android config file , but still it is not working as a native app and windows app preview mode. I cross verified that the 

    <script src="intelxdk.js"></script>
    <script src="xhr.js"></script>
    <script src="cordova.js"></script>

are also included in my index.html file. Can anyone please guide me that what is wrong with my setup ? 

0 Kudos
2 Replies
Swati_S_Intel1
Employee
1,132 Views

Hi Amar,

Did you try using Cordova CLI 3.5 for Windows build? Let us know if you still have this issue.

Swati

0 Kudos
Amar_Deep_S_
Novice
1,132 Views

This One is duplicate of other issue and that was already resolved with your help Swati. 

0 Kudos
Reply