Advertisement
Guest User

Untitled

a guest
Jul 25th, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. (function($) {
  2. $(document).on( 'click', 'a.mylink', function( event ) {
  3. $.ajax({
  4. url: testing.ajax_url,
  5. data : {
  6. action : 'diplay_user_table'
  7. },
  8. success : function( response ) {
  9. jQuery('#user_reponse').html( response );
  10. }
  11.  
  12.  
  13. })
  14. })
  15. })(jQuery);
  16.  
  17. add_action( 'wp_enqueue_scripts', 'ajax_test_enqueue_scripts' );
  18. function ajax_test_enqueue_scripts() {
  19. wp_enqueue_script( 'test', plugins_url( '/test.js', __FILE__ ), array('jquery'), '1.0', true );
  20.  
  21.  
  22. wp_localize_script( 'test', 'testing', array(
  23. 'ajax_url' => admin_url( 'admin-ajax.php' )
  24. ));
  25. }
  26.  
  27.  
  28. add_action('wp_ajax_my_action', 'diplay_user_table');
  29.  
  30.  
  31.  
  32. function diplay_user_table() {
  33.  
  34.  
  35. echo "function is loading in div";
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement