Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta charset="utf-8" />
- <title>Stock Market Game PRE ALPHA BETA</title>
- </head>
- <body>
- <script src="jquery.js"></script>
- <SCRIPT>
- var Market = {};
- var Stocks = [];
- Market.getQuote = function(symbol, fCallback){
- this.symbol = symbol;
- this.fCallback = fCallback;
- this.DATA_SRC = "http://dev.markitondemand.com/Api/v2/Quote/jsonp";
- this.makeRequest();
- }
- Market.getQuote.handleSuccess = function(jsonResult){
- this.fCallback(jsonResult);
- }
- Market.getQuote.handleError = function(jsonResult){
- console.error(jsonResult);
- }
- Market.makeRequest = function () {
- //Abort any open requests
- if (this.xhr) { this.xhr.abort(); }
- //Start a new request
- this.xhr = $.ajax({
- data: { symbol: this.symbol },
- url: this.DATA_SRC,
- dataType: "jsonp",
- success: this.handleSuccess,
- error: this.handleError,
- context: this
- });
- };
- function addStock(){
- alert("derp");
- // Stocks.push(ele.getAttribute)
- }
- </SCRIPT>
- <form onsubmit = "addStock()">
- <input type="text" name="stock" value =""><br><br>
- <input type="submit" value="Get Price">
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement