Software Archive
Read-only legacy content
17061 Discussions

Problem AJAX call in ios build

Theo_v_
Beginner
324 Views

Hi,

Whenever I build my project for iOS and install it on a iphone the ajax call below fails silently (no alerts).
In a mobile browser  on the same device it works fine though. JQuery is initialised correctly, any suggestions?

Thanks!

var jqxhr = $.ajax({
            method: "POST",
            url: "http://192.168.0.2:9292/db.php",
            crossDomain: true,
            data: { action: "doSomething"},
            error: function(){
                console.log(data);
                alert('There was an error');
            }
        } )
        .done(function(result) {
            alert ("COMPLETE!");
        })
        .fail(function(request, status, error) {
            alert  ( "error loading data" );
        })

 

 

 

0 Kudos
1 Reply
Theo_v_
Beginner
324 Views

AJAX calls are blocked by default
I forgot to white-list the domain in the IOS Build settings:
https://software.intel.com/en-us/xdk/articles/cordova-cli-412-domain-whitelisting-with-intel-xdk-for-ajax-and-launching-external-apps

 

0 Kudos
Reply