title: Javascript Function window.location.href
body: <p>I am trying to change the line</p>
  
  <pre><code>var url = window.location.href;
  </code></pre>
  
  <p>to point to an API which can get a shorted Link of the actual Page.</p>
  
  <p>My idea was to set it by this way</p>
  
  <pre><code>var url = 'http://bit.ly/api.php?url=' . urlencode('http://' . $_SERVER['HTTP_HOST']  . $_SERVER['REQUEST_URI']));
  </code></pre>
  
  <p>and send this to Twitter</p>
  
  <pre><code>var twit = 'http://twitter.com/home?status='+title+'%20'+url;
  </code></pre>
  
  <p>Get the report that i have a Syntax Error but dont know which one. </p>