Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- HTML
- Your score is <span>0</span>
- <button>Click me</button>
- -- Javascript include jquery
- $('button').click(function() {
- $.get('file.php', function(data) {
- $('span').html(data);
- }
- })
- -- PHP
- <?php
- session_start();
- if (!isset($_SESSION['scorekeeper']) {
- $_SESSION['scorekeeper'] = 1; // 1 because this is the first button press
- } else {
- $_SESSION['scorekeeper']++;
- }
- echo $_SESSION['scorekeeper']
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement