title: jquery ajax json parseerror valid json data
body: <p>Hi im having parseerror ajax call using jquery - servlet. im at lost. oh please what to do.
  and data from servlet is a valid json <code>{"success":true,"SelectPartid":{"partidAll":"DA04321;"}}</code></p>
  
  <p>if i discard the <code>dataType: 'json',</code>this work fine. but then i cant use this code</p>
  
  <p><code>if (data.success) {
  alert("SUCCESS!!");
  //alert("success" + data.SelectPartid.partidAll);
  }</code></p>
  
  <p>so, the ajax,please advise </p>
  
  <pre><code>$("#select1").change(function() {
      dataString = "Optionselected=" + $("#select1 option:selected").text();
      alert("dataString : " + dataString);
      $.ajax({
          type: 'POST',
          url: 'SelectAjx',
          data: dataString,
          dataType: 'json',
          contentType: "application/json; charset=utf-8",
          context: this,
          success: function(data, textStatus, jqXHR) {
              if (data.success) {
                  alert("SUCCESS!!");
                  //alert("success" + data.SelectPartid.partidAll);
              }
          },
          error: function(jqXHR, exception) {
              //alert('[jqXHR:' + jqXHR + '], [textStatus:' + textStatus + '], [thrownError:' + errorThrown + '])');
              if (jqXHR.status === 0) {
                  alert('Not connect.\n Verify Network.');
              } else if (jqXHR.status == 404) {
                  alert('Requested page not found. [404]');
              } else if (jqXHR.status == 500) {
                  alert('Internal Server Error [500].');
              } else if (exception === 'parsererror') {
                  alert('Requested JSON parse failed.');
              } else if (exception === 'timeout') {
                  alert('Time out error.');
              } else if (exception === 'abort') {
                  alert('Ajax request aborted.');
              } else {
                  alert('Uncaught Error.\n' + jqXHR.responseText);
              }
          }
      });
  });
  </code></pre>