Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/408.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Android上Phonegap中未显示jQuery_Javascript_Android_Jquery_Cordova_Phonegap Build - Fatal编程技术网

Javascript Android上Phonegap中未显示jQuery

Javascript Android上Phonegap中未显示jQuery,javascript,android,jquery,cordova,phonegap-build,Javascript,Android,Jquery,Cordova,Phonegap Build,我在使用Phonegap的Android应用程序上调用了jQuery。仅仅通过互联网,我的jQuery就如预期的那样被读取 我的配置文件有: <?xml version='1.0' encoding='utf-8'?> <widget id="com.bunchofus.basicphonegap" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/

我在使用Phonegap的Android应用程序上调用了jQuery。仅仅通过互联网,我的jQuery就如预期的那样被读取

我的配置文件有:

<?xml version='1.0' encoding='utf-8'?>
<widget id="com.bunchofus.basicphonegap" version="1.0.0"    xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0">

<access origin="*" />

我的HTML和jQuery是:

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/xml; charset=utf-8" />
<meta name="format-detection" content="telephone=no" />
<meta name="msapplication-tap-highlight" content="no" />
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
 <link rel="stylesheet" type="text/css" href="css/bunch.css" />
 <script src="http://code.jquery.com/jquery-1.11.3.min.js" type="text/javascript"></script>
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery('#topbar').load('http://www.bunchofus.com/app/topbar.php');  
jQuery('#posts').load('http://www.bunchofus.com/app/recentposts.php');
});
</script>

</head>      
<body>
<div id="topbar">

</div>
<div id="posts">

</div>
</body>

jQuery(文档).ready(函数(){
jQuery('#topbar')。加载('http://www.bunchofus.com/app/topbar.php');  
jQuery('#posts').load('http://www.bunchofus.com/app/recentposts.php');
});
在此方面的任何帮助都将不胜感激

谢谢

***更新****

我现在让它工作了。在配置文件中,我需要添加:

差距:plugin name=“cordova plugin whitelist”source=“npm”/>

我的HTML是:

<script type="text/javascript" src="cordova.js"></script>
<script src="js/jquery-1.11.3.js" type="text/javascript"></script>
<script type="text/javascript">
document.addEventListener('deviceready', this.onDeviceReady, false);    
function onDeviceReady() {
$('#posts').load('http://www.bunchofus.com/app/recentposts.php');
};  
</script>

文件.addEventListener('devicerady',this.ondevicerady,false);
函数ondevicerady(){
$('#posts')。加载('http://www.bunchofus.com/app/recentposts.php');
};  

不管它是否完全正确,它都在工作

为了让回答者或其他有类似问题的人更容易回答,请添加一个特定的问题陈述——“它不起作用”,可以假设,但它怎么不起作用呢?什么样的错误消息或错误行为是其特征?不要使用jquery mobile CDN,下载他们的js和css并在本地使用,在做任何事情之前也要使用Cordova/Phonegap deviceready事件。我同意jcesarmobile和simon的观点。您还需要实现
白名单
——这也会有所帮助。谢谢你的回复。我来试一试。