title: Wordpress - fetch user info using jQuery ajax POST request
body: <p>I am working in Wordpress trying to use an ajax request to fetch user data by passing the user id.</p>
  
  <p>I can see that the user id sends correctly via AJAX POST but I am getting an internal error message and I don't know why.</p>
  
  <p>At first I thought it was because I was trying to fetch some custom fields that I had added to the user profile but even when I simplified my script I am still getting the error message.</p>
  
  <p>Any help is much appreciated!</p>
  
  <p><strong>Front End</strong></p>
  
  <pre><code>$('.author').click(function() {
  
      var id   = $(this).attr('id');
      var temp = id.split('-');
      id = temp[1];
  
      $.ajax({
              type: 'POST',
              url: 'wp-content/themes/twentyeleven/author_info.php',
              data: {id: id},
              dataType: 'html',
              success: function(data) {
                  $('#author-bio').html(data);        
              }
          });     
  
      return false;
  });
  </code></pre>
  
  <p><strong>author_info.php</strong></p>
  
  <pre><code>$user_id = $_POST['id'];
  $forename = get_the_author_meta('user_firstname', $user_id);
  $output = $user_id;
  echo $output;
  </code></pre>
  
  <p><strong>Error Message</strong></p>
  
  <p><code>500 (Internal Server Error) jquery.min.js:4</code></p>