forked from swiftype/swiftype-autocomplete-jquery
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcustom.html
More file actions
34 lines (30 loc) · 1.21 KB
/
Copy pathcustom.html
File metadata and controls
34 lines (30 loc) · 1.21 KB
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
<!DOCTYPE html>
<html>
<head>
<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js'></script>
<script type='text/javascript' src='jquery.swiftype.autocomplete.js'></script>
<link type='text/css' rel='stylesheet' href='autocomplete.css' media='all' />
<script type='text/javascript'>
$(function() {
var customRenderFunction = function(item, config) {
var out = '<p class="title">' + item['title'] + '</p>';
out = out.concat('<p class="url">' + item['author'] + '</p>');
return out;
};
$('#st-search-input').swiftype({
engineKey: 'cZGa59zZiDxbcsZaFNAX',
renderFunction: customRenderFunction,
searchFields: {'books': ['title'], 'magazines': ['name']},
fetchFields: {'books': ['title','author','price']},
filters: {'books': {'in_stock': true}}
});
});
</script>
</head>
<body>
<form>
<h1>Example Swiftype Autocomplete installation</h1>
Search your site: <input type='text' id='st-search-input' class='st-search-input' />
</form>
</body>
</html>