私はphonegapアプリを開発している初心者です。私はすでにこれらの投稿をチェックしました: jquery.load() は phonegap で動作せず、phonegapでjquery load() を使用してページをロードする方法とjquery .load() 関数は phonegap では動作しません... しかし、何も役に立たないようです。
エミュレーターの代わりに jquery と外部デバイスを使用して phonegap でアプリを開発しています。私は 2 つの html を持っています: breakfast.htmlとtab.html
私のフォルダ構造は次のとおりです。
▸ merges/
▸ platforms/
▸ plugins/
▾ www/
▸ css/
▸ img/
▸ js/
▸ res/
▸ spec/
▾ static_pages/
▾ layouts/
tab.html
breakfast.html
config.xml
icon.png
index.html
spec.html
私のBreakfast.htmlは
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="format-detection" content="telephone=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/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="../css/custom_forms.css" />
<title>Hello World</title>
<script type="text/javascript" src="../phonegap.js"></script>
<script type="text/javascript" src="../js/index.js"></script>
<script type="text/javascript" src="../js/bootstrap.min.js"></script>
<script type="text/javascript" src="../js/jquery-1.10.2.min.js"></script>
<script type="text/javascript">
app.initialize();
</script>
</head>
<body>
<header class="navbar navbar-fixed-top">
XXXXXXX
</header>
<div id="testing"></div>
<script>$( "#testing" ).load( "layouts/tab.html #test" );</script>
<footer class="navbar" id="footer_bottom">
XXXXXXXX
</footer>
</body>
</html>
私のtab.htmlは次のとおりです。
<div id="test" style="width:100%;heigt:90px;background:black;color:white;">
TESTING JQUERY
</div>
公式の api.jquery.com/load ページに関して、私が次にしなければならない ID を持つ html ファイルの一部を挿入するために私がしなければならないこと:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>load demo</title>
<style>
body {
font-size: 12px;
font-family: Arial;
}
</style>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
</head>
<body>
<b>Footer navigation:</b>
<ol id="result"></ol>
<script>
$( "#result" ).load( "ajax/test.html #container" );
</script>
</body>
</html>
何が間違っているのかわかりません。
以前にこの問題に直面し、その理由を理解している人はいますか?
前もって感謝します。
アップデート:
申し訳ありませんが、私は Android 用に開発しており、デバイスは Android 4.2.2 を搭載した LG optimus 2X です。