1

I'm creating a game in oTree where players all enter a round with a countdown timer. At any point, a player can make a decision and click the submit button. What I need is for this decision to be displayed to the players that have not yet made a decision.

I currently have the submit button storing the values at the group level, so the values can be accessed from any player. I added simple if statements on the web page to display what other players have done, and these values display correctly if the player refreshes their web page. Is there a command to either force players' web pages to refresh or advance?

I'm thinking the refresh will be the simplest solution since I can call group functions when a player presses the submit button. If there is no command, please push me toward whatever structure can display this type of information.

IonicSolutions
  • 2,559
  • 1
  • 18
  • 31
JWillban
  • 11
  • 1
  • There are many ways to [reload a page using JavaScript](https://stackoverflow.com/questions/3715047/how-to-reload-a-page-using-javascript). Instead of refreshing the entire page, I suggest to only refresh the part where the other player's decisions are displayed using an Ajax request which is executed every second or so. – IonicSolutions Jun 10 '19 at 11:11
  • Or if you are needing to update very frequently (I'd suggest that sending an ajax request every second is likely to be too much and could cause problems, especially when lots of users are doing it), you might be better with a solution based on websockets or server-sent-events. You can research these technologies online fairly easily. – ADyson Jun 10 '19 at 13:54

0 Answers0