2015-09-07 59 views

回答

0

只需将其用于Popup Button'onclick'事件即可。

jQuery('#popup-btn').on('click', function(e){ 
     jQuery.ajax({ 
      type:'POST', 
      data:{action:'your_function_name_here'}, 
      url: "<?php echo admin_url('admin-ajax.php'); ?>", 
      success: function(value) { 
       jQuery('#popup-body').html(value); 
       // you can also use .append or whatever based on your requirements 
      } 
     }); 
    }); 

并添加这些钩子。

add_action('wp_ajax_your_function_name_here', 'your_function_name_here'); 
    add_action('wp_ajax_nopriv_your_function_name_here', 'your_function_name_here') 
相关问题