title: Accessing Ajax Response Data
body: <p>I have this code that works well:</p>
  
  <pre><code>{"livre":"empty_name"}
  
      $.ajax({
          url: "sent.php",
          type: "post",
          dataType: "json",
          data: formdata,
          success: function (data) {
              switch (data.livre) {
                    case 'empty_name':
  
                    break;
          }
      });
  </code></pre>
  
  <p>but when i try this code (i need the id), the case "empty name" didn't works. The option selected will be the default case:</p>
  
  <pre><code>{"id":"","livre":"empty_name"}
  
      $.ajax({
          url: "sent.php",
          type: "post",
          dataType: "json",
          data: formdata,
          success: function (id, data) {
              switch (data.livre) {
                   case 'empty_name':
  
                   break;
          }
      });
  </code></pre>
  
  <p>Why? and how can be solved? thanks</p>