applications/stockprog/static/main.js
//Update the HTML output window according to new stock data in the DB.
Update the HTML output window according to new stock data in the DB.
Update the HTML output window according to new stock data in the DB .
function updates(ts) {
  var data = {"op":"updates", "ts":ts};
  lambda_post(data, function(data){
    if ("error" in data) {
      html_error = data.error.replace(/\n/g, '<br/>');
      $("#old_stocks").html("Error: <br/><br/>" + html_error
        + "<br/><br/>Consider refreshing.")
    } else {
      $("#old_stocks").append("Stock: " + data.result.old_stock +
        "  PRICE: " + data.result.stock_price + "<br/>");
      updates(data.result.ts);
    }
  });
}
function updates ( ts ) { var data = { "op" : "updates" , "ts" : ts } ; lambda_post ( data , function ( data ) { if ( "error" in data ) { html_error = data . error . replace ( / \n / g , '<br/>' ) ; $ ( "#old_stocks" ) . html ( "Error: <br/><br/>" + html_error + "<br/><br/>Consider refreshing." ) } else { $ ( "#old_stocks" ) . append ( "Stock: " + data . result . old_stock + "  PRICE: " + data . result . stock_price + "<br/>" ) ; updates ( data . result . ts ) ; } } ) ; }
Update the HTML output window according to new stock data in the DB.
Update the HTML output window according to new stock data in the DB .
//Request the latest data (uses timestamp to find newest). //Access parts of the retrieved row using column names. //Update again.