Phonegap Ajax jQuery移动版

We are a group of french students, developing a Phonegap app (HTML, JQuery mobile, JQuery with AJAX, PHP). We use Phonegap build to compile our HTML, CSS, JS files.

We want to display dynamic content (from our database) with an Ajax call. The following code :

function loadDetailsLieux() {
    var infoLieu = $('#info_lieu ul:first');
        $.ajax({
            type: 'GET',
            url: 'PHP_URL_ON_SERVER.php?&jsoncallback=?', //Here we put the URL of the server where we put our PHP file
            dataType: 'JSONp',
            timeout: 8000,
            success: function(data) {
                $.each(data, function(i,item){

            infoLieu.append('<li class="left">'+item.adresse+'</li>');
            infoLieu.append('<li class="left">'+item.code_postal+'</li>');
            infoLieu.append('<li class="left">'+item.metro+'</li>');
                });



                },
            error: function(data) {
                infoLieu.append('<li>There was an error');
                alert('Buuuug');
            }


        });
    }

    loadDetailsLieux(); 

This code : - works well in the Web - BUT NOT ON PHONEGAP! - On Phonegap it just works AFTER clicking on an external link (and then returning to the app)

So we don't understand why it doesn't display the dynamic content when we arrive to our app...

Please, help us if you have an idea :D

I think you forgot to update your access policy to allow all urls, update your config.xml file with the following code:

<access origin="*" />