Advertisement
Guest User

Untitled

a guest
Apr 8th, 2016
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 1.30 KB | None | 0 0
  1. <!DOCTYPE html>
  2.  
  3. <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
  4. <head>
  5.     <meta charset="utf-8" />
  6.     <title>Stock Market Game PRE ALPHA BETA</title>
  7. </head>
  8. <body>
  9.    
  10.         <script src="jquery.js"></script>
  11.     <SCRIPT>
  12.        
  13. var Market = {};
  14. var Stocks = [];
  15.  
  16.  
  17. Market.getQuote = function(symbol, fCallback){
  18.     this.symbol = symbol;
  19.     this.fCallback = fCallback;
  20.     this.DATA_SRC = "http://dev.markitondemand.com/Api/v2/Quote/jsonp";
  21.     this.makeRequest();
  22. }
  23. Market.getQuote.handleSuccess = function(jsonResult){
  24.     this.fCallback(jsonResult);
  25. }
  26. Market.getQuote.handleError = function(jsonResult){
  27.     console.error(jsonResult);
  28. }
  29. Market.makeRequest = function () {
  30.     //Abort any open requests
  31.     if (this.xhr) { this.xhr.abort(); }
  32.     //Start a new request
  33.     this.xhr = $.ajax({
  34.         data: { symbol: this.symbol },
  35.         url: this.DATA_SRC,
  36.         dataType: "jsonp",
  37.         success: this.handleSuccess,
  38.         error: this.handleError,
  39.         context: this
  40.     });
  41. };
  42. function addStock(){
  43.    alert("derp");
  44.   // Stocks.push(ele.getAttribute)
  45. }
  46.  
  47.     </SCRIPT>
  48.     <form onsubmit = "addStock()">
  49.         <input type="text" name="stock" value =""><br><br>
  50.         <input type="submit" value="Get Price">
  51.     </form>
  52.        
  53. </body>
  54. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement