Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
- <script>
- function delay(ms) {
- var start = +new Date;
- while ((+new Date - start) < ms);
- }
- var p_type = 2;
- function postData(){
- console.log("hi.......")
- if(p_type == 1){
- $.ajax({
- url: "/testpage/test.php",
- type: 'GET'
- });
- }else if(p_type == 2){
- $("#sform")[0].trackdata.value = "{a:1,b:2,c:3} ";
- $("#sform")[0].submit();
- }else if(p_type == 3){
- //$("<img src='/testpage/test.php' />")
- var newim = document.createElement("img")
- newim.src = '/testpage/test.php';
- //document.body.app
- }
- //delay(1500);
- console.log("hi in timeout.......")
- }
- window.onbeforeunload = function(){
- postData();
- }
- </script>
- </head>
- <body>
- <h1>HI</h1>
- <a href="http://www.google.com" >next link </a>
- <form id="sform" action="/testpage/test.php" method="POST" target="hiframe">
- <input type="hidden" name="trackdata" value = "">
- </form>
- <iframe name="hiframe" style="display:none;" src = "about:blank"></iframe>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement