Advertisement
michaelyuen

Untitled

May 25th, 2018
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // your ajax.php
  2. if (isset($_POST['checkLikes'])) {
  3. exit('hello world');
  4. }
  5.  
  6. // your test.php
  7. <div id="response"></div>
  8.  
  9. <script
  10.   src="https://code.jquery.com/jquery-3.3.1.min.js"
  11.   integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
  12.   crossorigin="anonymous"></script>
  13. <script>
  14.     setInterval(function(){
  15.         $.ajax({
  16.             type: "POST",
  17.             url: "ajax.php",
  18.             data: {'checkLikes' : 'test'},
  19.             success: function (response) {
  20.                 $('#response').html(response);
  21.                 console.log(response);
  22.             }
  23.         })
  24.     });
  25. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement