This may seem like a silly question at first, but I can't seem to get jQuery to load another page - when I include a link:
<a href="test.html" data-pop >Go to the test page</a>
The address (assuming we're coming from index.html) simply acquires a #test.html, which means the end of my address ends up looking like this:
html/index.html#test.html
My question is, how do I get it load another page? Here's my source code:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a1/jquery.mobile-1.0a1.min.c开发者_高级运维ss" />
<script src="http://code.jquery.com/jquery-1.4.3.min.js"></script>
<script src="http://code.jquery.com/mobile/1.0a1/jquery.mobile-1.0a1.min.js"</script>
<title>Test</title>
</head>
<body>
<div data-role="page">
<div data-role="header"></div>
<div data-role="content">
<p>This is a test</p>
<a href="test.html" data-pop >Go to the test page</a>
</div>
<div data-role="footer"></div>
</div>
</body>
</html>
Your answer is documented here. This script included between jquery and jquery mobile worked:
$(document).bind("mobileinit", function() {
$.mobile.ajaxLinksEnabled = false;
});
Keep in mind that it didn't work for jquery mobile 1.0a1, but it works with 1.0a2.
So whole index.html would look like this:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a2/jquery.mobile-1.0a2.min.css" />
<script src="http://code.jquery.com/jquery-1.4.3.min.js"></script>
<script type="text/javascript">
$(document).bind("mobileinit", function() {
$.mobile.ajaxLinksEnabled = false;
});
</script>
<script src="http://code.jquery.com/mobile/1.0a2/jquery.mobile-1.0a2.min.js"></script>
<title>Test</title>
</head>
<body>
<div data-role="page">
<div data-role="header"></div>
<div data-role="content">
<p>This is a test</p>
<a href="test.html" data-pop >Go to the test page</a>
</div>
<div data-role="footer"></div>
</div>
</body>
</html>
精彩评论