title: How to get the PHP AJAX error to get to show up in my jQuery code?
body: <p>I have some PHP AJAX code that is supposed to validate some parameters sent by jQuery and return some values. Currently, it consistently returns invokes the jQuery error case, and I am not sure why.  </p>
  
  <p>Here is my jQuery code:</p>
  
  <pre><code>$('.vote_up').click(function() 
  {        
      alert ( "test: " + $(this).attr("data-problem_id") );
      problem_id = $(this).attr("data-problem_id");
  
      var dataString = 'problem_id='+ problem_id + '&amp;vote=+';
  
      $.ajax({
                  type: "POST",
                  url: "/problems/vote.php",
                  dataType: "json",
                  data: dataString,
                  success: function(json)
                  {           
                      // ? :)
                      alert (json);
  
  
                  },
                  error : function(json) 
                  {
                  alert("ajax error, json: " + json);
  
                  //for (var i = 0, l = json.length; i &lt; l; ++i) 
                      //{
                      //  alert (json[i]);
                      //}
                  }
              });
  
  
      //Return false to prevent page navigation
      return false;
  });
  </code></pre>
  
  <p>and here is the PHP code.  The validation errors in PHP do occur, but I see no sign that the error that is happening on the php side, is the one that is invoking the jQuery error case.</p>
  
  <p>This is the snippet that gets invoked:</p>
  
  <pre><code>if ( empty ( $member_id ) || !isset ( $member_id ) )
  {
      error_log ( ".......error validating the problem - no member id");
      $error = "not_logged_in";
      echo json_encode ($error);
  }
  </code></pre>
  
  <p>But how do I get the "not_logged_in" to show up in my JavaScript of the jQuery so that I know it is the bit that got returned? And if it isn't, how do I make it that that error is what comes back to the jQuery?</p>
  
  <p>Thanks!</p>