forked from meltingice/ajax-chosen
-
Notifications
You must be signed in to change notification settings - Fork 5
/
index.html
47 lines (40 loc) · 1.35 KB
/
index.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
<!DOCTYPE html>
<html lang="en">
<head>
<title>Ajax-Chosen: Bootstrapping a Popular jQuery Plugin to add Ajax Autocomplete</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/chosen/1.5.1/chosen.jquery.min.js"></script>
<script type="text/javascript" src="lib/ajax-chosen.js"></script>
<link type="text/css" rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/chosen/1.5.1/chosen.min.css" />
<style type="text/css">
#example1, #example2, #example3 { width: 300px; display: block; }
</style>
<script type="text/javascript">
$(document).ready(function () {
$("#example1,#example2,#example3").ajaxChosen({
type: 'GET',
url: '/data.json',
dataType: 'json'
}, function (data) {
var terms = {};
$.each(data.states, function (i, val) {
terms[i] = val;
});
return terms;
});
});
</script>
</head>
<body>
<h1>Ajax-Chosen: Bootstrapping a jQuery Plugin</h1>
<div>
<h2>Multi Select</h2>
<select id="example1" title="Search for a state" multiple></select><br /><br />
<select id="example3" title="Search for a state" multiple></select>
</div>
<div>
<h2>Single Select</h2>
<select id="example2" title="Select for a state" search><option></option></select>
</div>
</body>
</html>