-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAjax_a4.1.htm
64 lines (60 loc) · 1.65 KB
/
Ajax_a4.1.htm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, minimum-scale=1, maximum-scale=1">
<title>App Name</title>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.css" />
<script type="text/javascript" src="http://code.jquery.com/jquery-1.5.2.min.js"></script>
<script type="text/javascript">
$(document).bind("mobileinit", function(){
$('#bar').live('pagebeforeshow',function(event, ui){
$.mobile.pageLoading();
$('#dynamicContentHolder').text('');
var dynamicDataResp = $.ajax({
url: "./dynamicData.htm",
async: false,
cache: false
});
if(dynamicDataResp.status == 200){
//To stuff with content
}
else{
$.mobile.changePage('#error', 'none', false, false);
}
});
});
</script>
<script type="text/javascript" src="http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.js"></script>
</head>
<body>
<div id="foo" data-role="page">
<div data-role="header">
<h1>Foo</h1>
</div>
<div data-role="content">
<h2>Foo</h2>
<a href="#bar">To bar</a>
</div>
</div>
<div id="bar" data-role="page">
<div data-role="header">
<h1>Bar</h1>
</div>
<div data-role="content">
<ul data-role="listview" id="dynamicContentHolder">
</ul>
<br/>
<a href="#foo" data-inline="true" data-role="button" >To foo</a>
</div>
</div>
<div id="error" data-role="page">
<div data-role="header">
<h1>Error</h1>
</div>
<div data-role="content">
Click back to return to the previous page.
</div>
</div>
</body>
</html>