1. #1
    Sencha User
    Join Date
    Oct 2013
    Posts
    19
    Vote Rating
    1
    a3366873 is on a distinguished road

      1  

    Default Ajax and Phonegap

    Ajax and Phonegap


    Hi,

    I know that it is more Phonegap issue, but maybe someone knows what to do.
    I try to run simple ajax request from my phonegap based mobile app (installed on device) but request always fails.
    I tried <access origin="" /> setting in config.xml with wildcard, exact domain and removing access tag since docs claim that it allows all domains by default.

    In manifest there is permission for internet:
    <uses-permission android:name="android.permission.INTERNET" />

    What else do I need to configure to access external server via Ajax request?

    code from launch function:
    Code:
            Ext.Ajax.request({
                url: 'http://ip.jsontest.com/',
                success: function(response){
                    alert(response.responseText);
                },
                failure: function(response, opts) {
                    alert('failure: ' + JSON.stringify(response));
                }
            });
    response status is 0...
    tried with useDefaultXhrHeader: false but with same result. AFAIK packaged apps are not affected by CORS mechanism.

  2. #2
    Sencha - Support Team
    Join Date
    Oct 2011
    Posts
    3,967
    Vote Rating
    133
    fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all

      0  

    Default


    What version of phonegap and Touch are you using?
    Have you checked their Jira project to see if there was any report of a bug.
    https://issues.apache.org/jira/brows...ect%20%3D%20CB
    Have you tried using a different version of phonegap?
    Have you tried debugging with Weinre?
    http://people.apache.org/~pmuellr/weinre/docs/latest/
    Get more personalized support via a support subscription.

    Want to learn Sencha Touch 2? Check out
    Sencha training
    Sencha Touch in Action

    Need more help with your app? Hire Sencha Services services@sencha.com

    When posting code, please use BBCode's CODE tags.

    Need to include a test case use:
    The official Sencha Fiddle

Thread Participants: 1