简体   繁体   中英

Phonegap Android with JSONP Not Working

I'm making a Phonegap app for Android with JSONP but is not working on the APK. Some of the code is in Spanish but makes no difference.

<!DOCTYPE html>
<html>
<head>
    <script type="text/javascript" charset="utf-8" src="phonegap.js"></script>
    <script src="jquery.min.js"></script>
    <script src="jquery.jsonp-2.4.0.min.js"></script>
<script>
$(document).ready(function(){
    var output = $('#output');

    $.ajax({
        url: 'http://www.laprepie.com/form/sql/1.php',
        dataType: 'jsonp',
        jsonp: 'jsoncallback',
        timeout: 5000,
        success: function(data, status){
            $.each(data, function(i,item){ 
                var landmark = item.ID_Sucursal+item.Numero+item.Direccion;
                output.append(landmark);
            });
        },
        error: function(){
            output.text('There was an error loading the data.');
        }
    });
});
</script>
</head>
<body>
<ul id="output"></ul>
</body>
</html>

But when I do the apk (I'm using online APK Builder from phonegap build.phonegap.com ) and then I install on my phone, this does not work at all.

On my Laptop works wonderful.

Really Need help with this, is making me crazy! thanks!

After a loooong night trying to understand what was wrong with my code.

I used this Tutorail http://www.gajotres.net/building-a-native-mobile-app-with-phonegap-and-jquery-mobile-1-4/

And compile the apk with the CLI system and worked!

No idea Why!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM