-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
51 lines (51 loc) · 2.19 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
48
49
50
51
<html>
<head>
<title>jQuery examplecode OpenSearch</title>
<script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-1.5.2.min.js"></script>
<script src="https://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.14/jquery-ui.min.js"></script>
<link rel="Stylesheet" href="https://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.14/themes/black-tie/jquery-ui.css" />
<script type="text/javascript">
// notice: you need jQuery 1.5.2 and jQuery UI 1.8.9
// See also http://jsfiddle.net/derkmdt/qukTa/1/
$(document).ready(function () {
$("#searchfield").autocomplete({
source: function (request, response) {
$.ajax({
cache: true,
dataType: 'jsonp',
error: function () {
response([]);
},
jsonp: false,
jsonpCallback: 'search_suggestions_callback',
success: function (data) {
console.log(data);
var suggestions = [];
$.each(data[1], function (key, val) {
suggestions.push(val);
});
response(suggestions);
},
url: window.location.protocol + '//zoeksuggesties.s-bol.com/extern/qs/OpenSearchJSCB/search_suggestions_callback/media_all/' + encodeURIComponent(request.term)
});
},
select: function(event, ui) {
//assign value back to the form element
if(ui.item){
$(event.target).val(ui.item.value);
}
//submit the form
$(event.target.form).submit();
}
});
});
</script>
</head>
<body>
<form>
<input type="hidden" name="action" value="searchresults" />
<input type="text" id="searchfield" name="term" />
<input type="submit" value="Search" id="search" />
</form>
</body>
</html>