Phonegap jQuery.ajax requests works on AVD but fails on real device

303 Views Asked by At

I have this annoying problem on my app PhoneGap that the request below works fine on my web browser and my AVD, but fails on device, I keep getting readyState 0, can anyone help?

var appCredentials = "client_id=MY_CLIENT_ID&client_secret=MY_CLIENT_SECRET";

function loadVenues(){

    var url = "https://api.foursquare.com/v2/venues/search?";
    var ll = "&ll=-23.6057,-46.6662&limit=4";
    var request = url+appCredentials+ll;

    $.ajax({
        dataType: "json",
        url: request,
        success: loadVenuesSuccess,
        error: error
        });

}

function error(param1, param2, param3){
    alert(JSON.stringify(param1));
        alert(param2);
            alert(param3);
}

Please note that it works on both browser and AVD.

1

There are 1 best solutions below

0
On

Had the same issue, in my case the problem was my url contained htaccess information like (http://username:[email protected]/.....)

took me hours to find that bug in phonegap (works on every others plattform, also the avd etc, only on the real device not.)

Not sure that is your problem, but it might give you a hint were to investigate further...