forked from commadelimited/autoComplete.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcomplex.html
78 lines (62 loc) · 1.8 KB
/
complex.html
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
65
66
67
68
69
70
71
72
73
74
75
76
77
<!DOCTYPE html>
<html>
<head>
<title>jQM Autocomplete</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/latest/jquery.mobile.min.css" />
<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script src="http://code.jquery.com/mobile/latest/jquery.mobile.min.js"></script>
<script src="jqm.autoComplete-1.3.js"></script>
</head>
<body>
<div data-role="page" id="mainPage">
<div data-role="header">
<h1>jQM Autocomplete</h1>
<div data-role="navbar">
<ul>
<a href="index.html" data-ajax="false">Remote [ ]</a>
<a href="complex.html" data-ajax="false" class="ui-btn-active">Remote { }</a>
<a href="array.html" data-ajax="false">Local [ ]</a>
<a href="local_complex.html" data-ajax="false">Local { }</a>
<a href="callback.html" data-ajax="false">Callback</a>
</ul>
</div>
</div>
<div data-role="content">
<h3>Remote Complex Data</h3>
<p>
In this example autoComplete returns an array of objects from a remote url, each with a label and a value key.
</p>
<pre>
[
{
value: "22",
label: "Maine"
},
{
value: "23",
label: "Maryland"
}
]
</pre>
<p>
<input type="text" id="searchField" placeholder="US States">
<ul id="suggestions" data-role="listview" data-inset="true"></ul>
</p>
<p>
<a href="https://github.com/commadelimited/autoComplete.js" data-role="button">Download the code</a>
</p>
</div>
</div>
<script>
$("#mainPage").on("pageshow", function(e) {
$("#searchField").autocomplete({
target: $('#suggestions'),
source: 'data.cfc?method=search&returnformat=json&data=complex',
link: 'target.html?term=',
minLength: 1
});
});
</script>
</body>
</html>