Advertisement
Guest User

test.html

a guest
Aug 13th, 2014
375
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.20 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3.     <head>
  4.         <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
  5.         <script>
  6.  
  7.         function delay(ms) {
  8.             var start = +new Date;
  9.             while ((+new Date - start) < ms);
  10.         }
  11.  
  12.         var p_type = 2;
  13.  
  14.         function postData(){
  15.            
  16.             console.log("hi.......")
  17.            
  18.            
  19.             if(p_type == 1){
  20.                 $.ajax({
  21.                     url: "/testpage/test.php",
  22.                     type: 'GET'
  23.                 });
  24.             }else if(p_type == 2){
  25.                
  26.                     $("#sform")[0].trackdata.value = "{a:1,b:2,c:3} ";
  27.                     $("#sform")[0].submit();       
  28.                
  29.                
  30.             }else if(p_type == 3){
  31.                 //$("<img src='/testpage/test.php' />")
  32.                 var newim = document.createElement("img")
  33.                 newim.src = '/testpage/test.php';
  34.                 //document.body.app
  35.             }
  36.            
  37.             //delay(1500);
  38.  
  39.             console.log("hi in timeout.......")
  40.         }
  41.  
  42.  
  43.  
  44.         window.onbeforeunload = function(){
  45.             postData();
  46.            
  47.         }
  48.         </script>
  49.     </head>
  50.     <body>
  51.         <h1>HI</h1>
  52.         <a href="http://www.google.com" >next link </a>
  53.         <form id="sform" action="/testpage/test.php" method="POST" target="hiframe">
  54.             <input type="hidden" name="trackdata" value = "">
  55.         </form>
  56.         <iframe name="hiframe" style="display:none;" src = "about:blank"></iframe>
  57.     </body>
  58. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement