Polling

Creating get request

Getting response

Parsing response

Exercise: Show the chat messages on the page.

Continuous requests

Exercise: Continuously show the latest chat messages on the page.
Hint: Clear an element by setting its innerHTML property to "".

Bonus Exercise: Make another text box for the user's name, and show the user's name next to each message.
Hint: When sending multiple things to the server, separate each key-value pair with an &:
request.send("name=" + name + "&message=" + message);
Last topic Next topic