0

I am trying to display and update text from the database on multiple devices simultaneously. once someone enters in the game skip the click button check and enter straight into the game to whichever button the player has pressed.

heres the site

What I have tried:

I have tried ajax requests to update the text but it only works on one device

setInterval(function () {
function here
},500);

my logic

54x1
  • 93
  • 7
  • What are you updating if I may ask? – Leon Kunštek Jan 01 '20 at 23:18
  • yeh im just getting results from the database to update the screen on every device that logs into the game – 54x1 Jan 01 '20 at 23:24
  • so when you click a button it spits out a random question from the database then it shows it on only one screen i want it on all logged in screen – 54x1 Jan 01 '20 at 23:25
  • So you can't get the text to update on multiple devices at once? – Leon Kunštek Jan 01 '20 at 23:28
  • yepp im unsure of how to simultaneously update all logged in devices – 54x1 Jan 01 '20 at 23:29
  • Take a look at this, it might solve your problem: https://stackoverflow.com/questions/16107842/how-to-update-page-content-while-multiple-users-view-it-at-the-same-time-in-php. – Leon Kunštek Jan 01 '20 at 23:31
  • ive seen that but u have to install stuff i was wondering if there is away to do it like a chatting application if that makes sense – 54x1 Jan 01 '20 at 23:35
  • Well I think you could execute an ajax call every let's say 1-2 seconds and update text on a specific website. – Leon Kunštek Jan 01 '20 at 23:38
  • yep but how do u make it display on other devices coz right now it only works on one device – 54x1 Jan 01 '20 at 23:41
  • I'll look into it and give you a response when I'm done. – Leon Kunštek Jan 01 '20 at 23:45
  • This might help: https://stackoverflow.com/questions/12486885/javascript-and-php-countdown-timer-that-displays-the-same-for-everyone. Also check this out: https://www.smashingmagazine.com/2012/05/building-real-time-commenting-system/. – Leon Kunštek Jan 02 '20 at 00:18
  • sorry but the magazine one needs a plugin i think and the stack one is setInterval but not one that has a way to use onclick ? – 54x1 Jan 02 '20 at 10:03
  • You could make it work with onclick. – Leon Kunštek Jan 02 '20 at 15:13
  • the problem is i want the same question to display/load on other screens without clicking and then click the button to load a new question then display on other screens without clicking does that make sense? – 54x1 Jan 03 '20 at 01:44

0 Answers0