我正在用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生成器),然后在手机上安装时,这根本不起作用。
在我的笔记本电脑上工作得很好。
真的需要帮助,这让我疯了!谢谢
经过一个漫长的夜晚,我试图理解我的代码出了什么问题。
我使用了此教程邮件http://www.gajotres.net/building-a-native-mobile-app-with-phonegap-and-jquery-mobile-1-4/
并用CLI系统编译了apk并成功了!
不知道为什么!