Explorar el Código

Ajax affichage score

Loquicom hace 6 años
padre
commit
bc832c1f56
Se han modificado 1 ficheros con 12 adiciones y 3 borrados
  1. 12 3
      js/script.js

+ 12 - 3
js/script.js

@@ -30,11 +30,12 @@ $(document).ready(function(){
 
     //Rechargement
     $("#reload").on('click', function(){
-    	location.href = './';
-    });
+    	//location.href = './';
+        reload_score();
+    }).click();
     //Recharge toutes les minutes
     setTimeout(function(){
-    	location.href = './';
+    	$("#reload").click();
     }, 60 * 1000);
 
     //Reset
@@ -55,6 +56,14 @@ $(document).ready(function(){
 
 });
 
+function reload_score(){
+    $.post("ajx/score.php", null, function(data){
+        if(data.etat == 'ok'){
+            $("#tbody").html(data.html);
+        }
+    }, 'json');
+}
+
 function message_erreur(msg){
     var html = '';
     html += '<div class="hide-on-small-only">' + "\n";