daily pastebin goal
9%
SHARE
TWEET

Untitled

a guest Jan 21st, 2016 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. this is index.php
  2.  
  3.  
  4. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  5. <html xmlns="http://www.w3.org/1999/xhtml">
  6.  
  7. <head>
  8.     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  9.    
  10.     <title>Click Map</title>
  11.    
  12.     <link rel="stylesheet" type="text/css" href="stylemap.css" />
  13.    
  14.     <script src="http://www.google.com/jsapi" type="text/javascript"></script>
  15.     <script type="text/javascript">
  16.         google.load("jquery", "1.3");
  17.     </script>
  18.        
  19.  
  20.  
  21. </head>
  22.  
  23. <body>
  24.    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
  25.     <script>
  26.     var start;
  27.  
  28.     $(document).ready(function() {
  29.     start = Date.getTime();
  30.  
  31.     $(window).unload(function() {
  32.       end = Date.getTime();
  33.       $.ajax({
  34.         url: 'timer.php',
  35.        type: 'POST',
  36.         data: {
  37.                 'timeSpent': end - start,
  38.                 x:'hello'
  39.               }
  40.       })
  41.     });
  42.         $( window ).unload(function() {
  43.             return "Bye now!";
  44.         });
  45.     }
  46.  
  47. </script>
  48.    
  49.    
  50.     <img src="baywatch.jpg" alt="baywatch" />
  51.     <?php
  52.  
  53.    echo("<p><a href='timer.php'>Voir time Spent</a></p>");
  54.     ?>
  55.    
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62. </body>
  63. </html>
  64.  
  65.  
  66. and in timer.php i put
  67.  
  68. <?php
  69.  
  70.  
  71. $v2=$_POST['timeSpent'];
  72.  
  73. echo "Your Time Spent is $v2";
  74.  
  75.  
  76.  
  77.  
  78. ?>
RAW Paste Data
Top