title: Wordpress plugin development - AJAX JSON data is sending correctly but PHP response is always 0, why?
body: <p>I must be missing something simple here. Firebug shows data being sent exactly as it should in NET tab (NET tab-> Post -> Parameters). PHP function will not even echo simple text. </p>
  
  <p>The PHP:</p>
  
  <pre><code>add_action('wp_ajax_nopriv_process_json', 'process_json_received');
  add_action('wp_ajax_process_json', 'process_json_received');
  
  function process_json_received(){
  echo "ANYTHING...";
  exit;
  }
  </code></pre>
  
  <p>The JS/Jquery (sending correctly)</p>
  
  <pre><code>var data =  JSON.stringify({ action: 'process_json', value_name: 'value'  });//generic sample
  
  $.ajax({ url: 'http://localhost:12345/site_name/wp-admin/admin-ajax.php', 
                 data: {data: data},
                 type: 'post',
                 dataType: 'json',
                 success: function (response) {
                 alert("Got this from the server: " + response);
                 console.log( response );
                 $('body').append(response); // &lt;-- Append the ajax response to the page body
              },
              complete: function(XMLHttpRequest, text_status) {
  
                    },
                  error: function (response) {
                      alert("Error getting php file");
              }
  });
  </code></pre>
  
  <p>Again, it doesn't matter what is in the PHP function, the response is always 0. It could be an "enqueue_scripts" thing but ajax request is sending exactly as it should. NET tab in Firebug shows perfect json data so the problem has to be with the PHP function (or correct access to it). Maybe Wordpress is somehow blocking it??? Has to be something simple - I'm hoping a fresh set of eyes will help. Thanks in advance...</p>