title: Redirect Url not working and getting No 'Access-Control-Allow-Origin' header Error
body: <p>I am trying to send an Ajax request to a Nodejsserver from my application, but getting this error</p>
  
  <pre><code>Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
  </code></pre>
  
  <p>I am sending request using ajax call to a server (nodejs), server in turn will return url , in success function, should redirect the url sent by server.</p>
  
  <pre><code>//nodejs app.js
  var express = require('express');
  var app = express();
  var cors = require('cors');
  var link= require('./routes/link');
  
  
  app.use('/quote', link);
  
  app.use(cors());
  
  module.exports = app;
  
  //link.js
  var express = require('express');
  var app = express();
  var cors = require('cors');
  var router = express.Router();
  router.get('/', function (req, res) {
      res.send({ redirectUrl: "https://www.google.com" });
  });
  
  module.exports=router;
  
  //frontend
  $.ajax({
        method: 'get',
        url: '/quote',
        data: {
          id: "1",
          cn: "IN",
        },
        success: function (result) {
            window.location.href = result.redirectUrl; // url got from server
        },
        error: function (request, status, error) {
          console.log(request.error);
        }
      });
  
  </code></pre>