/demo/example_duckduckgo.html
https://github.com/pawelczak/EasyAutocomplete · HTML · 37 lines · 26 code · 11 blank · 0 comment · 0 complexity · 0fc64534b8bb6feb93e4278077e3150a MD5 · raw file
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <title>EasyAutocomplete duckduckgo example</title>
- <link href="../dist/easy-autocomplete.min.css" rel="stylesheet" type="text/css">
- <script src="../node_modules/jquery/dist/jquery.min.js"></script>
- <script src="../dist/jquery.easy-autocomplete.min.js" type="text/javascript"></script>
- </head>
- <body>
- <h1>EasyAutocomplete - duckduckgo example</h1>
- <input id="ddg"/>
- <script>
- var options = {
- url: function (phrase) {
- return phrase !== '' ? 'http://api.duckduckgo.com/?q=' + phrase + '&format=json' : 'http://api.duckduckgo.com/?q=empty&format=json';
- },
- getValue: 'Text',
- ajaxSettings: {
- dataType: 'jsonp'
- },
- listLocation: 'RelatedTopics'
- };
- $('#ddg').easyAutocomplete(options);
- </script>
- </body>
- </html>