Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- add_action( 'wp_ajax_my_action', 'my_action_callback' );
- function my_action_callback() {
- wp_die($_POST);
- }
- ?>
- <script>
- function ajax_test(){
- var str = $('#post').serialize() + '&action=my_action';
- $.ajax({
- type: 'POST',
- url: ajaxurl,
- data: str,
- success: function(data){
- console.log(data);
- },
- error : function (jqXHR, textStatus, errorThrown) {
- $('body').html(jqXHR + ' :: ' + textStatus + ' :: ' + errorThrown);
- }
- });
- return false;
- }
- setInterval(function(){ajax_test();}, 20000);
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement