title: Glassdoor API not working with $http.get
body: <p>I'm having an issue with my AngularJS call to Glassdoor API. It keeps giving me No 'Access-Control-Allow-Origin' header is present on the requested resource.</p>
  
  <pre><code>$http.get('https://api.glassdoor.com/api/api.htm?t.p=P_KEY&amp;t.k=KEY&amp;userip=0.0.0.0&amp;useragent=&amp;format=json&amp;v=1&amp;action=employers&amp;q=ibm').then(function(resp) {
      console.log(resp.data);
      $scope.employers = resp.data;
  }, function(error, resp) {
      console.log(error, resp);
  });
  </code></pre>
  
  <p>It does work if I click the link specifically but the angular call doesn't. </p>
  
  <p>Server.js to deal with CORS.</p>
  
  <pre><code>var express = require('express');
   var mysql = require('mysql');
   //var bodyParser = require('body-parser'); // pull information from HTML POST (express4)
   var app = express();
   var cors = require('cors');
  var serveStatic = require('serve-static');
  var data = '';
  
  
  var connection = mysql.createConnection({
  host: 'localhost',
  port: '3306',
  user: 'root',
  password: '',
  database: 'jobs'
  });
  
  //app.use(cors({origin: 'http://localhost:YOUR_PORT'}));
  app.use(function(req, res, next) {
   res.header("Access-Control-Allow-Origin", "*");
   res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
   next();
   });
  
   app.use(serveStatic(require("path").join(__dirname, "/views"))); // Serves everything in the views directory
   // Example: url.com/css/style.css serves views/css/style.css
  
    app.get('/api/jobs', function(req, res, next) {
    connection.query('SELECT * FROM jobs ORDER BY company ASC', function(err, results) {
    if (err) {
        console.log('There was a problem reading from jobs database :' + err.stack);
        res.sendStatus(500).send('There was a problem reading from jobs database');
        return;
    }
  
    console.log('results:', results);
    res.send(results);
   });
  });
  
  app.post('/api/jobs_post', function(req, res, next){
  
  });
  
  var server = app.listen(8081, function() {console.log("Running")});
  
  var gracefulShutdown = function() {
  console.log('Shutting down');
  server.close(function() {
      console.log('Closed out remaining connections');
  });
  connection.end(function(err) {
      if (err) {
          console.log('There was an error closing the connection to jobs database: ' + err.stack);
      } else {
          console.log('Connection terminated successfully!')
      }
  });
  }
  process.on('SIGTERM', gracefulShutdown); // Server is killed
  process.on('SIGINT', gracefulShutdown); // Ctrl-C is pressed in the terminal
  </code></pre>
  
  <p>This is my fun personal project: <a href="https://csjobsco-gchavez1011.c9users.io:8081/index.html" rel="nofollow">https://csjobsco-gchavez1011.c9users.io:8081/index.html</a></p>