/demo/example_duckduckgo.html

https://github.com/pawelczak/EasyAutocomplete · HTML · 37 lines · 26 code · 11 blank · 0 comment · 0 complexity · 0fc64534b8bb6feb93e4278077e3150a MD5 · raw file

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <title>EasyAutocomplete duckduckgo example</title>
  5. <link href="../dist/easy-autocomplete.min.css" rel="stylesheet" type="text/css">
  6. <script src="../node_modules/jquery/dist/jquery.min.js"></script>
  7. <script src="../dist/jquery.easy-autocomplete.min.js" type="text/javascript"></script>
  8. </head>
  9. <body>
  10. <h1>EasyAutocomplete - duckduckgo example</h1>
  11. <input id="ddg"/>
  12. <script>
  13. var options = {
  14. url: function (phrase) {
  15. return phrase !== '' ? 'http://api.duckduckgo.com/?q=' + phrase + '&format=json' : 'http://api.duckduckgo.com/?q=empty&format=json';
  16. },
  17. getValue: 'Text',
  18. ajaxSettings: {
  19. dataType: 'jsonp'
  20. },
  21. listLocation: 'RelatedTopics'
  22. };
  23. $('#ddg').easyAutocomplete(options);
  24. </script>
  25. </body>
  26. </html>