【发布时间】:2016-09-10 23:30:19
【问题描述】:
我正在尝试连接到外部 POST api 以进行身份验证。 我正在尝试:
$http({
method : 'POST',
url : 'myURL',
data : {"j_username": "myUserName,"j_password": "myPassword"},
headers : {
'Content-Type': 'application/x-www-form-urlencoded',
}
})
但是我收到了这个错误:
XMLHttpRequest 无法加载 http://...url。预检的响应是 无效(重定向)
【问题讨论】:
-
该错误告诉您此 URL 在请求时重定向到另一个。查看此answer 了解更多详情。
-
你的 myUserName 后面也少了一个 " 标记
标签: javascript angularjs