title: No 'Access-Control-Allow-Origin' header is present
body: <p>I am using angular.js to make a ReSTful app for mobile devices using cordova.
  for server side I am using slim framework.all according to this tutorial:(<a href="http://www.angularcode.com/user-authentication-using-angularjs-php-mysql/" rel="nofollow">http://www.angularcode.com/user-authentication-using-angularjs-php-mysql/</a>)</p>
  
  <p>But when i uploaded api folder to server, error occurs :
  No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'localhost' is therefore not allowed access. The response had HTTP status code 404.</p>
  
  <p>I have read about adding "Access-Control-Allow-Origin"
  and implemented it according to this link : 
  <a href="http://help.slimframework.com/discussions/problems/810-no-subject" rel="nofollow">http://help.slimframework.com/discussions/problems/810-no-subject</a></p>
  
  <pre><code>$app-&gt;get('/session', function() {
      **$response-&gt;header('Access-Control-Allow-Origin', '*');**  
      $db = new DbHandler();
      $session = $db-&gt;getSession();
      $response["uid"] = $session['uid'];
      $response["email"] = $session['email'];
      $response["name"] = $session['name'];
      echoResponse(200, $session);
  });
  </code></pre>
  
  <p>also tried </p>
  
  <pre><code>$app-&gt;get('/session', function() {
      **$session-&gt;header('Access-Control-Allow-Origin', '*');**  
      $db = new DbHandler();
      $session = $db-&gt;getSession();
      $response["uid"] = $session['uid'];
      $response["email"] = $session['email'];
      $response["name"] = $session['name'];
      echoResponse(200, $session);
  });
  </code></pre>
  
  <p>I am still receiving the same error.</p>
  
  <p>--> Also is the last line correct ? <code>echoResponse(200, $session);</code> </p>
  
  <p>Thank You in advance :)</p>
  
  <h2>update</h2>
  
  <p>I am using same file on  firefox and chrome and chrome is able to access the file on server. 
  Also one JSON file on my server was being accessed by cordova app earlier and now is not working. The calling code is exactly same ie </p>
  
  <pre><code>.controller('ListController', ['$scope', '$http', function($scope, $http) {
    $http.get('js/data.json').success(function(product_data) {
      $scope.artists = product_data;
    });
  }])
  </code></pre>