title: Server responded with a status of 401 - No 'Access-Control-Allow-Origin' header - Angular Js - working fine with Jquery Ajax
body: <p>Client side : <strong>AngularJS</strong></p>
  
  <p>Server / tech : <strong>Apache / Java Spring</strong></p>
  
  <p>First error was the No Access Control Allow Origin header not present. We fixed that by adding <a href="https://stackoverflow.com/a/28117763/3192693">this code</a> to the server side. The request is working fine with <em>postman</em>.</p>
  
  <p>In Controller function http get method is returning error 401 (Unauthorized).</p>
  
  <pre><code>$http.get("our_local_url").then(function(data) {
                  console.log("data:"+data);
              }, function(error) {
                  console.log("error:"+error);
              });
  </code></pre>
  
  <p>A Test page with Jquery Ajax Call is working fine with the code</p>
  
  <pre><code>$.ajax({
          url: "our_local_url",
          type: "GET",
          success: function(result){
              console.log(result);
          },
          error: function(xhr,status,error){
              console.log(error);
          }
  });
  </code></pre>
  
  <p>I've gone through several SO answers before asking this. </p>