<!--

ajax12.html

Gets stock quote (plus day's low and high) from quote7.php via Ajax
using jQuery, embedding (JSON) result in page itself.

David J. Malan
Computer Science S-75
Harvard Summer School

-->

<!DOCTYPE html>

<html>
  <head>
    <script src="http://code.jquery.com/jquery-latest.js"></script>
    <script>

        $(document).ready(function() {
            $("#form").submit(function() {
                $.ajax({
                 url: "quote7.php",
                 data: { 
                  symbol: $("#symbol").val()
                 },
                 success: function(data) {
                   $("#price").html(data.price);
                   $("#high").html(data.high);
                   $("#low").html(data.low);
                 }
                });
                return false;
            });
        });

    </script>
    <title></title>
  </head>
  <body>
    <form id="form">
      Symbol: <input id="symbol" type="text">
      <br><br>
      Price: <span id="price"></span>
      <br>
      High: <span id="high"></span>
      <br>
      Low: <span id="low"></span>
      <br>
      <br><br>
      <input type="submit" value="Get Quote">
    </form>
  </body>
</html>