Advertisement
Guest User

Untitled

a guest
Dec 18th, 2014
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4.     <meta charset="utf8">
  5.     <title>Paper Heros Comics Inventory Locator</title>
  6.     <link rel="stylesheet" href="/PH_Inventory/jquery-ui-1.11.2.custom/jquery-ui.css">
  7.     <script src="/PH_Inventory/jquery-1.11.2.min.js"></script>
  8.     <script src="/PH_Inventory/jquery-ui-1.11.2.custom/jquery-ui.js"></script>
  9.     <style>
  10.         #cards { width: 25em; }
  11.     </style>
  12.    
  13. </head>
  14. <body>
  15.    
  16. <script>
  17.     $(function(){
  18.             $( "#cards" ).autocomplete({
  19.                 delay: 500,
  20.                 minLength: 3,
  21.                 source: function( request, response ){
  22.                     console.log("entering source");
  23.                     $.getJSON("http://yugiohprices.com/api/card_data/" + request.term, function(data){
  24.                         var card = $.parseJSON(data);
  25.                         console.log(JSON.stringify(card));
  26.                         response(card.name);
  27.                     });
  28.                 },
  29.                 focus: function(event, ui) {
  30.                     // prevent autocomplete from updating the textbox
  31.                     event.preventDefault();
  32.                 },
  33.                 select: function(event, ui) {
  34.                     // prevent autocomplete from updating the textbox
  35.                     event.preventDefault();
  36.                 }
  37.             });
  38.     });
  39. </script>
  40.  
  41. <div class="ui-widget">
  42.     <label for="cards">Cards: </label>
  43.     <input id="cards">
  44. </div>
  45.  
  46. </body>
  47. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement