繁体   English   中英

带有JSONP的Phonegap Android无法正常工作

[英]Phonegap Android with JSONP Not Working

我正在使用JSONP开发适用于Android的Phonegap应用,但无法在APK上运行。 一些代码是西班牙语,但没有区别。

<!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>

但是,当我执行apk(我正在使用来自phonegap build.phonegap.com的在线APK Builder),然后将其安装在手机上时,这根本不起作用。

在我的笔记本电脑上,效果很好。

真的需要帮助,这让我发疯了! 谢谢!

经过漫长的夜晚,试图了解我的代码出了什么问题。

我使用了这个Tutorail http://www.gajotres.net/building-a-native-mobile-app-with-phonegap-and-jquery-mobile-1-4/

并使用CLI系统编译apk并成功!

不知道为什么!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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