Is it possible to use Jquery ajax implement interaction between users?

Two users have logged into the site, one of them makes a change to the database, which is accessed simultaneously (for example: the contents of which are open in both - they simultaneously see the same data), and that the second user needs after saving these data without reloading the page - saw them!

Is it possible to do this on jQuery ajax? Or need some other technology?

Reported as a duplicate by participants Alexey Shimansky , Community Spirit 12 Aug '16 at 10:29 .

A similar question was asked earlier and an answer has already been received. If the answers provided are not exhaustive, please ask a new question .

1 answer 1

Well, in general, this is what ajax is for. If you need to put

 setInterval(function(){ $.ajax({тело запроса}) }, 1000) - здесь интервал обновления данных 

Well, print the new result in some element on the page. So in a bunch of php + jquery such are written generally on the fly

  • And it is possible that not to update through the time interval, but only then - when a new record arrives in the database? And do not wake up problems when at the same time in several users want to make changes? - Maybe_V
  • A good question, like jquery, you won’t get it, because we cannot find out about changes on the server without a request to the server. So, in the request, you can register some kind of request identifier, and see if it is the last, then do not update the information, but in general if several users make changes at the same time, the last one will be saved - Andrey Tregubov
  • probably all the same it will be necessary in the accelerated mode to study node.js and socket.io - Maybe_V
  • And pull the base once a second? And if a thousand users ..... your server will not die? - Alexey Shimansky