Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

201
Views
Live Update Score On a php Score board for user

I want live score board screen in php. I have completed all on click button + or - score board is dynamically change score. But we need to refresh page look latest score. I want as we click + or - button to change score that score should be directly update score on screen for user without refreshing page. What is the solution? Is there a code for this purpose. Please help me. Thanks...

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

It's hard to answer without having knowledge on how actually you have implemented your code, I can only give basic idea on this.

You need 3 files for this, as

  1. main.html:- where the scoreboard is included.
  2. scoreboard.php:- where the scoreboard is shown.
  3. updateSB.php:- where the scoreboard is updated.

main.html

<div class="somediv">
  <div class="scoreboard" id="scoreboard">
  <!--This is the division I will load scoreboard dynamically-->
  </div>
</div>
<script>
 //Loading initial scoreboard here
 $('#scoreboard').load("scoreboard.php");
 //Now do ajax calls for '+' '-' buttons (onclick) here
 $.post("updateSB.php",{type : "plus/minus"},
 function(data, status){
   if(status=="success"){
     //Loading scoreboard for every update
     $('#scoreboard').load("scoreboard.php"); 
   }
 });
</script>

scoreboard.php

<div class="scoreboard">
  <div class="header">Some team <?echo $team1;?> vs team <?echo $team2?></div>
  <div class="body">
    some sort of table score here?
    Score :- <?echo $score;?>
  </div>
  <div class="footer"></div>
</div>

updateSB.php

<?
//Here is where you update ur scoreboard
if(isset($_POST['type']){
  if($_POST['type']=="plus"){
  //Perform plus on score
  }
  elseif($_POST['type']=="minus"){
  //Perform minus on score
  }
}
?>

Points to remember

  1. Use ajax in proper way ie, do right request and handle the request at backend correctly.
  2. Implementation of dynamic scoreboard is possible if you are using some global variables or database at the backend.

For any queries comment down.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!