Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $.ajax({
- url: "http://some.other.url.com:8880",
- type: "GET",
- crossDomain: true,
- contentType: 'application/json'
- }).then(function(response) {
- $scope.allData = jQuery.parseJSON( response );
- console.log($scope.allData);
- }).fail(function(response) {
- });
- var path = url.parse(req.url).pathname,
- match = router.match(path),
- rescode;
- console.log("---: " + req.method);
- if (req.method === 'OPTIONS') {
- var headers = {};
- headers["Access-Control-Allow-Origin"] = "*";
- headers["Access-Control-Allow-Methods"] = "POST, GET, PUT, DELETE, OPTIONS";
- headers["Access-Control-Allow-Credentials"] = false;
- headers["Access-Control-Max-Age"] = '86400'; // 24 hours
- headers["Access-Control-Allow-Headers"] = "X-Requested-With, X-HTTP-Method-Override, Content-Type, Accept";
- res.writeHead(200, headers);
- return res.end();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement