title: Angular jsonp.get: rejected although status code 200 Ok
body: <p>I'm trying to call my simple web api developed in Jersey, which results in:</p>
  
  <pre><code>[
      {
          "id": 1,
          "name": "Facebook",
          "userName": "abc@gmail.com",
          "password": "Qwerty@123"
      }
  ]
  </code></pre>
  
  <p>My jsonp get request looks like this:</p>
  
  <pre><code>this.jsonp.get('http://localhost:8080/api/rest/domains?callback=JSONP_CALLBACK')
              .toPromise()
              .then(response =&gt; console.log("Success: " + response),
                  err =&gt; console.log("Failed: " + err));
  </code></pre>
  
  <p>However, I'm getting following message printed in console:</p>
  
  <blockquote>
    <p>Failed: Response with status: 200 Ok for URL:
    <a href="http://localhost:8080/DomainServiceApi/rest/domains?callback=__ng_jsonp__.__req0.finished" rel="nofollow noreferrer">http://localhost:8080/DomainServiceApi/rest/domains?callback=<strong>ng_jsonp</strong>.__req0.finished</a></p>
  </blockquote>
  
  <p>I can't figure out what is wrong with this.</p>
  
  <p><b>EDIT: </b> Finally my problem got solved. I returned back to using http.get method. Then on removing my now useless in memory web api imports, I got the error message that "Access-Control-Allow-Origin" should be included in my headers in the response on server side. So I included this header in my Jersey web api and everything is working fine.</p>
  
  <p>If anyone is using Jersey, read <a href="http://www.codingpedia.org/ama/how-to-add-cors-support-on-the-server-side-in-java-with-jersey/" rel="nofollow noreferrer">How to add headers in Jersey response</a>.</p>