Question: A web page has a 'stock ticker' section where users can input the stock market abbreviation for a stock and have the current price of

A web page has a 'stock ticker' section where users can input the stock market abbreviation for a stock and have the current price of that stock show on the page.
For example, the stock market abbreviation for Microsoft is MSFT; if you type "MSFT" into the text input element and press the button, the code will get the current price for Microsoft stock and display it. A timer is then used to continuously check and update the stock price.
Write the code to implement this functionality using AJAX asynchronous programming.
When the button is clicked, an interval timer is started that asynchronously gets the current price from a database every minute (60,000 miliseconds).
On the server, there is a PHP file called "get_quote.php" that queries a stock market database for current prices. The SQL statement to get the current stock price is"SELECT curr_price FROM Stocks WHERE stock_abbrev =(abbreviation);
The return value from the database is a single value representing the stock price in dollar and cents format e.g."123.45". Use this value from the database to set the value of the element with id="stockValue".
If the stock abbreviation is spelled wrong or otherwise does not exist, the database returns zero rows. If this occurs, write "incorrect stock abbreviation" in the
html>

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!