Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Branch: master
47 lines (40 sloc) 1.327 kB
<!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="/dist/chosen/chosen/chosen.jquery.min.js"></script>
<script type="text/javascript" src="/lib/ajax-chosen.js"></script>
<link type="text/css" rel="stylesheet" href="/dist/chosen/chosen/chosen.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>
Jump to Line
Something went wrong with that request. Please try again.