title: Access hostname/port number to invoke ajax request
body: <p>I'm using an ajax request to retrun json from a URL.</p>
  
  <p>This is working locally as below : </p>
  
  <pre><code>$.ajax({
              url: "http://localhost:8080/updates.json",      
              type: 'post',
              dataType : "json",
              success : function(jsonResponse) {  
              }); 
  
              },
              error: function (err) {
              } 
  
          });
  </code></pre>
  
  <p>The url needs to be updated so that it works no matter the na eof server its deployed on.</p>
  
  <p>Can url be replaced with something like :  "http://"+getThisHostName()+":8080/updates.json" ?</p>
  
  <p>Is there a safe way of returning  the current hostname path ?</p>