Unload data from MySql without refreshing the page?

Make a small browser game. Its essence in the following: user creates a room, he enters the number. Next to it is connected and the second player tries to guess this number, it is given 10 attempts.

Implemented like this:
1. When a room is created in MySql table is created in the line: No. game, date, player 1 (the room Creator), its number, the second player, the number of the second player, the result (0 - 2 player joined, 1 - victory 1, 2 - victory of the second).
2. When a room is created from filled 4 columns of the row.
3. Player 2 opens the room and clicks the join button and enters the number
4. In the database in the line of this game is saved a login of the player 2 and its number.

The problem is the following: to the player 1 saw player 2 has joined the room he needs to reload the page. How to make player 2 at the first appear without reloading the page?
June 10th 19 at 15:59
3 answers
June 10th 19 at 16:01
Something like this will be
function func() {
 url: 'PHP.php',
 type: 'POST',
 data: {},
 success: function(xhr, data, textStatus) {}
setTimeout(func, 1000);
June 10th 19 at 16:03
A web socket
June 10th 19 at 16:05
Periodically (as in chat) send Ajax request to the server, even gave the condition of the room. If changed, redraw part of the page. To restart the whole page is such a web-one-zero, no words.

Find more questions by tags MySQLPHP