0
正常工作,出于某种原因,当我构建应用程序,并把它放在我的Android,但如果我在模拟器上运行它,它看起来和运行伟大的jQuery Mobile的将不会加载。请帮帮我。是否有任何额外的步骤需要采取措施使其工作或进行任何工作?jQuery Mobile的不PhoneGap的应用
<html>
<head>
<meta charset="utf-8" />
<meta name="format-detection" content="telephone=no" />
<!-- WARNING: for iOS 7, remove the width=device-width and height=device-height attributes. See https://issues.apache.org/jira/browse/CB-4323 -->
<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" />
<script type="text/javascript" src="cordova.js"></script>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" />
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
<style>
#container
{
margin: 8px;
}
</style>
<script>
var xmlhttp;
window.onload=function()
{
document.addEventListener("deviceready", init, false);
//init();
}
function init()
{
document.getElementById('btnHitServer').addEventListener('click', getServer, false);
xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = receiveServer;
}
function getServer()
{
xmlhttp.open('GET', 'http://app.mafialife.com/?email_debug=1', false);
xmlhttp.send();
}
function receiveServer()
{
if(xmlhttp.readyState==4 && xmlhttp.status==200)
{
var json = jQuery.parseJSON(xmlhttp.responseText);
// console.log(json);
document.getElementById('Server').innerHTML = json.value.joke;
}
}
</script>
<title>Hit Server</title>
</head>
<body>
<div id="container"></div>
<h2>Connect To Server</h2>
<button id="btnHitServer">Hit Server</button>
<p>Press the button to Connect To Server</p>
<div id="Server"></div>
</body>
</html>
所以我现在是本地存储jQuery的,但它在运行应用程序时仍然不会加载。 – Dave
您是否添加了一个设备准备事件监听器,并在回调函数中启动您的应用程序?科尔多瓦还没有准备好,直到事件发生。 –
我不确定。我将如何做到这一点? – Dave