This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Dec 2nd, 2012  |  syntax: None  |  size: 0.42 KB  |  views: 38  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. -- HTML
  2. Your score is <span>0</span>
  3. <button>Click me</button>
  4.  
  5. -- Javascript include jquery
  6. $('button').click(function() {
  7.    $.get('file.php', function(data) {
  8.      $('span').html(data);
  9.    }
  10. })
  11.  
  12. -- PHP
  13. <?php
  14. session_start();
  15. if (!isset($_SESSION['scorekeeper']) {
  16.   $_SESSION['scorekeeper'] = 1; // 1 because this is the first button press
  17. } else {
  18.   $_SESSION['scorekeeper']++;
  19. }
  20.  
  21. echo $_SESSION['scorekeeper']
clone this paste RAW Paste Data