title: AngularJS not able to access localhost:8080
body: <p>I am trying to access JSON from <a href="http://localhost:8080/daddy/" rel="nofollow">http://localhost:8080/daddy/</a>. This page is powered by glassfish server in the background. I am able to access this url from browser and I get the following result: </p>
  
  <pre><code>{"id":11,"content":"Hello, World!"}
  </code></pre>
  
  <p>But when I try to access it from AngularJS i get the following result: </p>
  
  <pre><code>{"data":null,"status":0,"config":{"method":"GET","transformRequest":[null],"transformResponse":[null],"url":"http://localhost:8080/daddy/","headers":{"Accept":"application/json, text/plain, */*"}},"statusText":""}
  </code></pre>
  
  <p>******* AngularJS Script ********</p>
  
  <pre><code>app.controller("HttpController", ['$http', function($http){
  
          var currentInstance = this;
  
          currentInstance.data = {};
  
      $http({
        method: 'GET',
        url: 'http://localhost:8080/daddy/'
      }).then(function successCallback(response) {
          currentInstance.data = response;
  
        }, function errorCallback(response) {
          currentInstance.data = response ;    
        });
  
  }]);
  </code></pre>
  
  <p>But when I use any public url for getting JSON, it returns just fine. There seems to be a problem with the localhost. Any help will be grateful!</p>