Guest User

Untitled

a guest
Feb 21st, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. var datastring = {
  2. newEmailForm: newEmailForm,
  3. properties: properties
  4. };
  5.  
  6. //got the data, make the ajax request
  7. jQuery(function(){
  8. jQuery.ajax({
  9. type:'POST',
  10. data:{
  11. action: 'elegantSendEmail',
  12. datastring: datastring
  13. },
  14. url: ajaxurl
  15. })
  16. })
  17.  
  18. action elegantSendEmail
  19. datastring[newEmailForm][0][] {…}
  20. 0 email
  21. 1 title
  22. 2 Message
  23. datastring[properties][0][] {…}
  24. 0 31466
  25. 1 value1
  26. 2 value1
  27. datastring[properties][1][] {…}
  28. 0 31440
  29. 1 value2
  30. 2 value2
  31.  
  32. $obj = json_decode($_POST['newEmailForm'][0], true);
  33.  
  34. echo '<pre>';
  35. print_r($obj);
  36. echo '</pre>';
  37.  
  38. $obj = json_decode($_POST['datastring']['newEmailForm'][0], true);
Add Comment
Please, Sign In to add comment