title: Ajax Working but empty response from AJAX in WordPress
body: <p>I try to code different way but i'm facing same issue, admin-ajax working well but nothing returning, Basically empty response, I just want to what i mass up with,</p>
  <p><strong>My HTML Code</strong></p>
  <pre><code>&lt;form action=&quot;&lt;?php echo home_url(&quot;/&quot;) ?&gt;&quot; method=&quot;post&quot;&gt;
      &lt;input type=&quot;text&quot; id=&quot;noman_input&quot; name=&quot;input_name_sb&quot;&gt;
      &lt;?php wp_nonce_field('sb_form');?&gt;
      
      &lt;input id=&quot;sub_form&quot;  class=&quot;btn btn-danger&quot;  type=&quot;submit&quot; value=&quot;Post Via Ajax&quot;&gt;
  &lt;/form&gt;
  
  </code></pre>
  <p><strong>PHP Code</strong></p>
  <pre><code>function form_sb_form(){
      $user_name = $_POST['input_name_sb'];
      echo $user_name;
      die();
  }
  
  add_action('wp_ajax_sb_form', 'form_sb_form');
  add_action('wp_ajax_nopriv_sb_form', 'form_sb_form');
  
  </code></pre>
  <p><strong>JS Code</strong></p>
  <pre><code> $(&quot;#sub_form&quot;).on('click', function(e) {
              e.preventDefault();
              var user_name = $(&quot;#noman_input&quot;).val();
  
              // i try with this code 
              $.ajax({
                  url: loc_data.ajax_url,
                  type: &quot;POST&quot;,
                  data: {
                      action: 'sb_form',
                      name: user_name
                  },
                  success: function(response) {
                      console.log(response)
                  },
              });
  
              // and this one as well
              $.post(loc_data.ajax_url, {
                  action: &quot;sb_form&quot;,
                  user_name: user_name,
              }, function(response) {
                  console.log(response);
              });
  
          });
  </code></pre>