How to keep an updated variable without refreshing in php? [closed]

0

I am working on a project of an auction page and I have a situation where I want that each time a user places a new offer, the value of the variable that shows the last offer is updated, for those who are on that page, No need to refresh ... to avoid discomfort. I would like to know the name of the method that is used to do it, it is not necessary a concrete example but if possible I appreciate it.

    
asked by Jamr07 30.07.2017 в 05:18
source

2 answers

0

With AJAX the value will be updated every X milliseconds; what you say. With WebSockets the value will be updated almost instantaneously. With AJAX and jQuery you can have the problem solved in 10 or 15 minutes or less. With WebSockets you will have to learn how it works first. I do not know any bookstore that encapsulates it in a simple way, although I would not be surprised if there was one. If you opt for WebSockets you can add another tool to your web developer's resume:)

    
answered by 30.07.2017 / 15:31
source
0

You could do an asynchronous function in javascript that is called every x time, for example 200 milliseconds, which includes an ajax call to the server that asks for the value of the variable. Which should be saved in a field of the database.

    
answered by 30.07.2017 в 15:14