I have a script that works every 10 seconds. Every time it triggers, the value of variables changes.

For example, the first time when it is triggered sheep=sheep11 , then sheep=sheep12 , sheep=sheep13 , sheep=sheep14 , etc. I need to transfer these js variables to php and display them when it changes, that is, every time 10 seconds pass. I tried to do it with ajax , and with the get method, but in vain.

 var i=11; var sheeps="sheep"; function funcBefore(){ var sheep= sheeps+(i++); } count = 0; intervalId = setInterval(function(){ count++; if(count == 10){ clearInterval(intervalId); } funcBefore(); }, 1000);` 
  • 3
    Very useful to read: phpfaq.ru/newbie/na_tanke - Ipatyev
  • @ Ipatiev Wow, this article answers about every fifth question on StackOverflow (Russian and English versions) with a PHP and JavaScript tag :). Added yourself bookmarks. - Arnial

0