daily pastebin goal
30%
SHARE
TWEET

Untitled

a guest Sep 14th, 2017 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //js
  2. jQuery( document ).ready(function() {
  3.     jQuery.ajax({
  4.         url: ajaxurl,
  5.         method: "POST",
  6.         data: {
  7.             name: "John",
  8.             location: "Boston",
  9.             action: "testing"
  10.         },
  11.         success: function(data) {
  12.             alert(data);
  13.         }
  14.     });
  15. })
  16.  
  17. //functions.php
  18. add_action( 'wp_ajax_testing', 'testing' );
  19.  
  20. function testing() {
  21.     echo $_POST['name'];
  22.     die();
  23. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top