Advertisement
Guest User

Untitled

a guest
Sep 14th, 2015
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. //php
  2. function change_subject(){
  3. $return = array(
  4. 'message' => 'Saved',
  5. 'ID' => 1
  6. );
  7.  
  8. wp_send_json_success($return);
  9. }
  10. add_action( 'wp_ajax_change_subject', 'change_subject' );
  11. add_action( 'wp_ajax_nopriv_change_subject', 'change_subject' );
  12.  
  13. //js
  14. $.post( ajax_search_filters_data.ajaxurl, {
  15. 'action' : 'change_subject_callback'
  16. },
  17. function( response ){
  18. console.log(response); //outputs 0
  19. },
  20. 'json');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement