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