title: Access-Control-Allow-Origin and Angular.js
body: <p>I've been trying to find a solution, but nothing I found so far worked. So I'm trying to do a HTTP request with angular to a weather API, but I keep getting this response:</p>
  
  <pre><code>Origin http://mydomain.com is not allowed by Access-Control-Allow-Origin. 
  </code></pre>
  
  <p><strong>What I've tried so far:</strong></p>
  
  <ol>
  <li><p>Adding this line to my app config</p>
  
  <p>delete $httpProvider.defaults.headers.common['X-Requested-With'];</p></li>
  <li><p>I Have tried multiple version's of angular, all with the same result</p></li>
  <li><p>Adding this to my .htacces</p>
  
  <p>Header add Access-Control-Allow-Origin "*"</p></li>
  <li><p>Adding the headers with PHP</p></li>
  <li><p>Trying different URL's for GET requests</p>
  
  <p>(even different API's, same result)</p></li>
  <li><p>Using the jQuery HTTP request instead of Angular's, same result...</p></li>
  </ol>
  
  <p><strong>My code</strong></p>
  
  <pre><code>       $http({
            method: 'GET',
            url: 'https://api.forecast.io/forecast/myapikey/52.370216,4.895168'
          }).
          success(function(response) {
              console.log('succes');  
              console.log(response);
          }).
          error(function(response) {
              console.log('failed');  
              console.log(response);
          });
  </code></pre>
  
  <hr>
  
  <p>None of these solutions seem to work, I've been using Angular before and normally adding <code>delete $httpProvider.defaults.headers.common['X-Requested-With'];</code> would resolve the issue</p>
  
  <p>I'm completely lost here, any help is appreciated, thanks!</p>