在我的jQuery手机(1.2版)网站,我有几个单独的页面(即每个页面有一个标题,内容和页脚)。问题是我无法链接页面。以下行不起作用。 <a href="anotherpage.html">Another Page</a>
显示“Error loading page”。jQuery手机页面链接不工作
如果我将rel="external"
添加到<a>
元素,它将起作用。但是,它会通过Ajax关闭自动加载。但我想使用Ajax加载以及将页面分开。只是想知道是否有可能。
代码页1
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Single page template</title>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"> </script>
</head>
<body>
<div data-role="page">
<div data-role="header">
<h1>Page 1</h1>
</div>
<div data-role="content">
<a href="b.html"> click me</a>
</div>
<div data-role="footer">
<h4>Footer content</h4>
</div>
</div>
</body>
</html>
代码页2
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Single page template</title>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"> </script>
</head>
<body>
<div data-role="page">
<div data-role="header">
<h1>Page 2</h1>
</div>
<div data-role="content">
page 2 content
</div>
<div data-role="footer">
<h4>Footer content</h4>
</div>
</div>
</body>
</html>
你确定你的页面层次结构是正确的?或者,你可以尝试使用绝对网址 – adamdehaven
向我们展示您的页面示例。这仅仅是不够的。 – Gajotres
当您点击链接时,您的地址栏中的网址是您期望的网址?即它试图链接到一个子目录或其他东西,但你想要的文件是在根?想不到更合乎逻辑的解释... – Mike