SHOW:
|
|
- or go back to the newest paste.
| 1 | // your ajax.php | |
| 2 | <?php | |
| 3 | if (isset($_POST['checkLikes'])) {
| |
| 4 | exit('hello world');
| |
| 5 | } | |
| 6 | ?> | |
| 7 | ||
| 8 | // your test.php | |
| 9 | <div id="response"></div> | |
| 10 | ||
| 11 | <script | |
| 12 | src="https://code.jquery.com/jquery-3.3.1.min.js" | |
| 13 | integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" | |
| 14 | crossorigin="anonymous"></script> | |
| 15 | <script> | |
| 16 | setInterval(function(){
| |
| 17 | $.ajax({
| |
| 18 | type: "POST", | |
| 19 | url: "ajax.php", | |
| 20 | data: {'checkLikes' : 'test'},
| |
| 21 | success: function (response) {
| |
| 22 | $('#response').html(response);
| |
| 23 | console.log(response); | |
| 24 | } | |
| 25 | }) | |
| 26 | }); | |
| 27 | </script> |