title: ajax not working while returning a String value
body: <p>I have written following jquery code in one of my Java project.</p>
  
  <pre><code>$(document).ready(function(){
      $('#searchBid').click(function(){
          alert("reached ajax");
          $.ajax({
              url: "/fetchbookingnumber",
              data: {id:$('#conBid').val()},
              timeout: 10000,
              type: "POST",
              cache: false,
              contentType: "application/x-www-form-urlencoded",
              dataType: "json",
              beforeSend:function(jqXHR, options) {
                  if($('#conBid').val()==''){
                      alert("Please enter a BookingID");  
                  } 
                  return false;
              }
          }).fail(function(jqXHR, textStatus, errorThrown){
              alert("The ajax call failed");
          }).done(function(resp, textStatus, jqXHR){
              $('#conBno').val(resp);
          });
      });
  });
  </code></pre>
  
  <p>The value that is being returned by database is a varchar. In my Java server I have stored the value in String. The problem I am facing is that as far as the returned value is a number (numeral) the ajax work but if the string returned is alphanumeric the ajax fails and .fail method is called.
  I guess the cause behind this is </p>
  
  <pre><code>contentType: "application/x-www-form-urlencoded",
  </code></pre>
  
  <p>How should I alter the code to make the ajax work in both the cases. Please some one lend a hand.</p>