Jquery mobile jQuery.load()无法使用PhoneGap构建和jQuery Mobile
我正在开发jQuery移动web应用程序。它是一个index.html文件,使用Jquery mobile jQuery.load()无法使用PhoneGap构建和jQuery Mobile,jquery-mobile,phonegap-build,Jquery Mobile,Phonegap Build,我正在开发jQuery移动web应用程序。它是一个index.html文件,使用data role=“page”在其中包含多个页面。每个页面都使用相同的页眉和页脚,因此我使用.load()在项目中加载单独的html文件 这在Chrome中可以正常工作,但在我将应用程序安装到运行iOS 8.3的iPhone上时就不行了。页眉和页脚根本不加载 /*** load headers and footer ***/ $(document).on('pageinit', function() { /
data role=“page”
在其中包含多个页面。每个页面都使用相同的页眉和页脚,因此我使用.load()
在项目中加载单独的html文件
这在Chrome中可以正常工作,但在我将应用程序安装到运行iOS 8.3的iPhone上时就不行了。页眉和页脚根本不加载
/*** load headers and footer ***/
$(document).on('pageinit', function() {
/* header */
$('.customHeader').load('../templates/header.html');
/* footer */
$('.customFooter').load('../templates/footer.html');
/* dining */
$('.banner.dining').load('../templates/dining.html');
});
我有jQuery在phonegap上也不适合我。有几件事,我改变了。希望这能有所帮助 是否将代码包装到文档onready()上 出于某种原因,当我准备好文档时,它就工作了。网络的工作方式不同 另外,确保jquery包含在脚本之前。我的jQuery将无法工作,除非这些在我的代码之前:
<script src="lib/jquery.min.js"></script>
<script src="lib/jquery-ui.min.js"></script>
谢谢您的回复。我的代码被包装在$(document.on('pageinit',function(){})中代码>,但在尝试$(文档)时无效。就绪(函数(){)}:
我的源代码顺序也正确。我上次加载了我的自定义脚本。除了白名单域之外,你找到解决方案了吗?
<script src="lib/jquery.min.js"></script>
<script src="lib/jquery-ui.min.js"></script>