title: Can't get my error message from json ajax request
body: <p>I use the <code>$.ajax()</code> jquery to do some ajax calls.  Recently i have one ajax call that returns json formatted string for a successful call.  In my server php code, if there is a problem, i just return a string data ( <code>die("nothing found in database");</code> ) , non-json formatted that is a message explaining the problem.  The ajax call works correctly, but I am having a hard time getting that string response.</p>
  
  <p>Here is the javascript code:</p>
  
  <pre><code>$.ajax({
      url: "check.php",
      dataType: "json",
      data: {
          row_id : row_id
      },
      async: false
  }).done(function(data) {
      check = data;
  }).fail(function( jqXHR, textStatus, msg ){
      $('#dialog').html("&lt;p&gt;"+textStatus+"&lt;/p&gt;");
      $('#dialog').dialog({
          modal: true,
          buttons: {
              "OK": function() {
                  $( this ).dialog("close");
              }
          }
      });
  });
  </code></pre>
  
  <p>None of the 3 variables in the <code>.fail()</code> function give me that string response I sent from the server.  That <code>textStatus</code> just gives me "parseerror".  The <code>msg</code> variable give me: "Unexpected token T".  What I want is just the plain string that I sent from the .php file with the <code>die()</code> function.  I tested to make sure the php is sending the string correctly.  Does anyone know how I should get my string data response? </p>
  
  <p>Maybe this isn't the correct way to handle this.  I am thinking because there really wasn't an error with the ajax call, its just I chose to return a normal string instead of JSON, which is a signal that there is a problem.</p>