Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- this is index.php
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <title>Click Map</title>
- <link rel="stylesheet" type="text/css" href="stylemap.css" />
- <script src="http://www.google.com/jsapi" type="text/javascript"></script>
- <script type="text/javascript">
- google.load("jquery", "1.3");
- </script>
- </head>
- <body>
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
- <script>
- var start;
- $(document).ready(function() {
- start = Date.getTime();
- $(window).unload(function() {
- end = Date.getTime();
- $.ajax({
- url: 'timer.php',
- type: 'POST',
- data: {
- 'timeSpent': end - start,
- x:'hello'
- }
- })
- });
- $( window ).unload(function() {
- return "Bye now!";
- });
- }
- </script>
- <img src="baywatch.jpg" alt="baywatch" />
- <?php
- echo("<p><a href='timer.php'>Voir time Spent</a></p>");
- ?>
- </body>
- </html>
- and in timer.php i put
- <?php
- $v2=$_POST['timeSpent'];
- echo "Your Time Spent is $v2";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement