ystanev

auction.html

Mar 25th, 2018
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html>
  3.  
  4. <head>
  5.     <title>Auction</title>
  6. </head>
  7.  
  8. <body>
  9.     <h1>Auction</h1>
  10.     <form id="items" action="">
  11.         <label for="description">Description:</label>
  12.         <input type="text" id="description">
  13.         <br>
  14.         <label for="strt_bid">Starting Bid:</label>
  15.         <input type="text" id="strt_bid">
  16.         <br>
  17.         <input type="submit" value="Submit">
  18.     </form>
  19.  
  20.     <script src="/socket.io/socket.io.js"></script>
  21.     <script src="https://code.jquery.com/jquery-1.11.1.js"></script>
  22.     <script>
  23.         //Make the connection
  24.         var socket = io();
  25.  
  26.         //Submit handler
  27.         $("#items").submit(function () {
  28.  
  29.             //Submit question data
  30.             socket.emit("submit_item", {
  31.                 description: $("#description").val(),
  32.                 strt_bid: $("#strt_bid").val()
  33.             });
  34.  
  35.             //Override default behaviour
  36.             return false;
  37.         });
  38.     </script>
  39. </body>
  40.  
  41. </html>
Add Comment
Please, Sign In to add comment