title: Jquery ajax encoding data
body: <p>I have this code (below)..</p>
  
  <pre><code>$.ajax
  ({
      type: "POST",
      url: "../WebServices/Feedback.svc/sendfeedback",
      dataType: 'json',
      async: false,
      data: '{"stars": "' + stars + '", "rating" : "' + rating + '", "note" : "' + encodeURIComponent(note) + '", "code" : "' + code + '", "permission" : "' + permission + '"}',
      contentType: "application/json; charset=utf-8"
  });
  </code></pre>
  
  <p>I am using this to pass in data to a web service but the problem is if there are any characters in there like this (, / ? : @ &amp; = + $ #). I have put in an encodeURIComponent which works fine and then in the web service I put them back again.</p>
  
  <p>What i'm asking is if there is a better way of accomplishing this? It seems a bit crazy that I have to encode the string each time before passing it through..</p>
  
  <p>Thanks</p>