【问题标题】:Phonegap Android with JSONP Not Working带有 JSONP 的 Phonegap Android 不工作
【发布时间】:2016-04-09 20:38:07
【问题描述】:

我正在使用 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)然后我安装在我的手机上时,这根本不起作用。

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

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

【问题讨论】:

标签: javascript android cordova jsonp phonegap-build


【解决方案1】:

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

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

并使用 CLI 系统编译 apk 并运行!

不知道为什么!

【讨论】:

    猜你喜欢
    • 2014-08-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-05-09
    • 1970-01-01
    • 2014-06-21
    相关资源
    最近更新 更多