title: How to calculate Content-Length in JavaScript
body: <pre><code>function LikesDislikes () {
  
      $.ajax({
          url: 'http://gdata.youtube.com/feeds/api/videos/keDZXXDxK1c/ratings',
          type:"POST",
          data: '&lt;?xml version="1.0" encoding="UTF-8"?&gt;
              &lt;entry xmlns="http://www.w3.org/2005/Atom"
                     xmlns:yt="http://gdata.youtube.com/schemas/2007"&gt;
                  &lt;yt:rating value="like"/&gt;
              &lt;/entry&gt;',
          headers: {
              "Content-Type":"application/atom+xml",
              "Content-Length":,
              "Authorization":"Bearer ya29.AHES6ZQ59RrQgujZmIjssBdYlwwLVrpCodnirdLROi7-g7U",
              "X-GData-Key":"key=AIzaSyAPrtP2Tq4m5WVInCvCWptVAKPhQ4SQNZA",
              "GData-Version":"2"
          },
          // Content-Type:"application/atom+xml",
          error: function() { alert("No data found."); },
          // contentType: "text/xml",
          success: function (response) {
              alert('response:' + response);
          }
     });
  
  }
  </code></pre>
  
  <p>How can I calculate the <code>Content-Length</code> in the above code?</p>