1

I searched similar questions but never found a proper answer. I am making app for multiple platforms using phonegap and JQM. I made index.html, which is "login page", with similar call. Index's call works, but the one below never gets called on my android device, even though it works both on chrome and safari.

I checked sever logs and there are no problems with "login", but as I said, there is no request from my android device when function below should be called.

    //document.addEventListener("deviceready", onDeviceReady, true);

$( document ).bind( "mobileinit", function(){
        $.support.cors = true;
        $.mobile.allowCrossDomainPages = true;
        $.mobile.loadingMessageTextVisible = true; 
        $.mobile.showPageLoadingMsg();
        console.log('Page Started');
})

//var onDeviceReady = function(){

$( document ).ready(function (){
        console.log('Start');
        //$.support.cors = true;
        //$.mobile.allowCrossDomainPages = true;
        $.ajax({                                                                   
        crossDomain: true,
        type: 'GET',
        url: 'http://ip/services/rest/contact/list', 
        callback: 'jsonpCallback',
        jsonpCallback: 'jsonpCallback',
        jsonp: '_jsonp',
        contentType:  'application/json',
        dataType: 'jsonp json',
        timeout : 10000,

        success: function(data){

            var html ='';
            console.log('Success');
            $.each(data.response, function(key, value) {
            html += '<li><a class=contact href="#" id="' + data.response[key].id + '" ><h1>' + data.response[key].label + '</h1><p>'+ data.response[key].customerName + '</p><p>' + data.response[key].phone + ', ' + data.response[key].email + '</p></a></li>';
            $('#ul_id').append($(html));
            html='';
            console.log('conatct');
            });
            $('#ul_id').trigger('create');    
            $('#ul_id').listview('refresh');

        },
        error: function (xhr, ajaxOptions, thrownError){
            alert("Status: " + xhr.status + ", Ajax option: " + ajaxOptions + ", Thrown error: " + thrownError);
            //location.reload();
            console.log('Blad');
        },
    }); 
});
nandeesh
  • 24,740
  • 6
  • 69
  • 79
Piotr Krysiak
  • 2,815
  • 3
  • 23
  • 35

2 Answers2

0

What is the access origin value in your Android project config.xml file ?

your value should be as below :

<access origin=".*"/>
rpelluru
  • 231
  • 1
  • 8
  • I think you mean ```` [Documentation](http://docs.phonegap.com/en/2.0.0/guide_whitelist_index.md.html#Domain%20Whitelist%20Guide) – Calavoow Aug 31 '12 at 10:17
0

There was a problem with placing script and specific way that jqm work.

Piotr Krysiak
  • 2,815
  • 3
  • 23
  • 35