This assignment will test your ability to use AJAX to communicate with the server from the client.
1. In the server, when the client requests the main page,
return a button called "increase" as well as a number
above that should start at 0.
2. Next, make it so that when a user presses that button, the
number increases. This should be pretty easy.
3. Finally, add a script into the client that sends the
server a request to check what the number is on the server and set
the number on the screen to be that. This way, the user wont
have to refresh the page to see how many people have pressed the button.
Part 3 will require that you modify the code that is sent to the client. You
really need to add in a timer that every 100 milliseconds (or whatever time increment),
requests an update from the server. Then you need to have a post location
that returns the new number of times the buttons have been pressed.
Example of AJAX request in javascript
$.ajax({ url: "/post", type: "POST", data: {clicked:click}, success: function(data){ console.log(data); shrooms = JSON.parse(data).list; } });
Dont forget to include the AJAX script! <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
Copy and paste your code into an email.