Please tell me how to make it so that when a new entry appears in the database that one person wants to add another person as a friend, a notification appeared on the page (Even if he does not reload the page). About consent or not. Throw what thread the idea about this, a suggestive example, thanks in advance.

  • one
    here you need 1 script, it has a query to the database, 5 lines in js (jquery) to implement ajax technology. PS what question, no one will do such an answer for you, show what you did yourself and what didn’t work - johniek_comp
  • At any user, when loading the page, by timer, an ajax request will be executed, the result of which will be the data you need. This scheme is valid both for notification of adding friends, and for notification of acceptance or rejection of an application. Here is very brief, want more? As already mentioned above, do something yourself and they will help you. - Zowie

1 answer 1

In order to be without a reboot, you need to drive the check function into setinterval:

$(document).ready(function() { setInterval(function() { //здесь код запроса к php скрипту //допустим, что скрипт возвращает нам количество заявок в друзья N if(N > 0){ //выводим сообщение } }, 2000); }); 

2000 corresponds to 2 seconds