SHARE
TWEET

Untitled

a guest Sep 14th, 2017 72 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
Top