AngularJS向远程Sails服务器发出请求。

3
我试图在前端使用AngularJS向运行Sails JS(NodeJS)的远程服务器发出请求,但是我收到了这个'null'来源错误:
XMLHttpRequest cannot load http://remoteserver:1337/login/. The 'Access-Control-Allow-Origin' header contains the invalid value ''. Origin 'null' is therefore not allowed access.

我的请求看起来像这样:

我的请求大概是这样的:

$http.post('http://remoteserver:1337/login/', { email: userData.email, password: userData.password}); 

有什么想法吗?

2
您需要在销售应用程序上启用cors。http://sailsjs.org/documentation/concepts/security/cors - David Zech
1个回答

6

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接