Advertisement
Guest User

Untitled

a guest
Sep 2nd, 2014
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. $.ajax({
  2. url: "http://some.other.url.com:8880",
  3. type: "GET",
  4. crossDomain: true,
  5. contentType: 'application/json'
  6. }).then(function(response) {
  7. $scope.allData = jQuery.parseJSON( response );
  8. console.log($scope.allData);
  9. }).fail(function(response) {
  10. });
  11.  
  12. var path = url.parse(req.url).pathname,
  13. match = router.match(path),
  14. rescode;
  15.  
  16. console.log("---: " + req.method);
  17.  
  18. if (req.method === 'OPTIONS') {
  19. var headers = {};
  20. headers["Access-Control-Allow-Origin"] = "*";
  21. headers["Access-Control-Allow-Methods"] = "POST, GET, PUT, DELETE, OPTIONS";
  22. headers["Access-Control-Allow-Credentials"] = false;
  23. headers["Access-Control-Max-Age"] = '86400'; // 24 hours
  24. headers["Access-Control-Allow-Headers"] = "X-Requested-With, X-HTTP-Method-Override, Content-Type, Accept";
  25. res.writeHead(200, headers);
  26. return res.end();
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement