Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <script src="https://code.jquery.com/jquery-latest.min.js"></script>
- <script>
- function quote()
- {
- var url = '/quote?symbol=' + $('#symbol').val();
- $.getJSON(url, function(data) {
- $('#quote').html('A share of ' + data.name + ' costs $' + data.price + '.');
- $('#symbol').val('');
- });
- }
- </script>
- <title>ajax2</title>
- </head>
- <body>
- <form onsubmit="quote(); return false;">
- <input autocomplete="off" autofocus id="symbol" placeholder="Symbol" type="text"/>
- <input type="submit" value="Get Quote"/>
- </form>
- <p id="quote"></p>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement