index.php
<?php
session_start();
?>
<html>
<body>
<input type="button" value="Show Score" id="show"/>
the score is <span id="score"></span>
</body>
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<script>
$(document).ready(function(e) {
$('#show').click(function fun1(){
$.ajax({
type : 'POST',
cache:'false',
url : 'ajaxScore.php',
success : function(res){
$('#score').html(res);
setInterval(fun1,300);
}
});
});
});
</script>
</html>
scoreAdmin.php
<?php
session_start();
$_SESSION['score']=$_REQUEST['sc'];
?>
<form>
<input name="sc"/>
<input type="submit" value="Update"/>
</form>
ajaxScore.php
<?php
session_start();
echo $_SESSION['score'];
?>
<?php
session_start();
?>
<html>
<body>
<input type="button" value="Show Score" id="show"/>
the score is <span id="score"></span>
</body>
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<script>
$(document).ready(function(e) {
$('#show').click(function fun1(){
$.ajax({
type : 'POST',
cache:'false',
url : 'ajaxScore.php',
success : function(res){
$('#score').html(res);
setInterval(fun1,300);
}
});
});
});
</script>
</html>
scoreAdmin.php
<?php
session_start();
$_SESSION['score']=$_REQUEST['sc'];
?>
<form>
<input name="sc"/>
<input type="submit" value="Update"/>
</form>
ajaxScore.php
<?php
session_start();
echo $_SESSION['score'];
?>
0 comments:
Post a Comment