P
P
Philipp R.2018-05-26 23:53:29
PHP
Philipp R., 2018-05-26 23:53:29

How to notify the user when changing the value of a variable?

Hello.
Tell me what you need to see and read, and it is desirable that there are examples, How to notify the user when the value of a variable changes?
More details:
The user is on the site https://mysite.ru/ (1C BITRIXCMS). And I need it to make an ajax request with an interval of 10 - 15 seconds or similar solutions that you can recommend. to /status.php with "change cod= 4054656", by default the server returns the response number 0, but when the response number to "/statu.php" is updated, the user will be notified.
Thanks in advance for your attention;)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
ipokos, 2018-05-27
@RFV_online

ajax is a way to pass data (i.e. the logic of the handler will not change whether you use it or not)

/* получаете переменную которая у пользвателя и ту с которой сравниваете, ну и собственно сравниваете */
if($userVar != $systemVar){ 
    return $notice;
}

function yourAjaxRequest(){
 // описываете ajax запрос
}
// задаете вызываемую функцию и интервал частоты запросов в мс (в примере 15 сек)
setInterval( yourAjaxRequest, 15000 );

but for some reason it seems to me that the difficulty is not in this ...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question