【问题标题】:404 error when I pass session ID in Post request from angular js当我在 Angular js 的 Post 请求中传递会话 ID 时出现 404 错误
【发布时间】:2014-03-17 07:53:33
【问题描述】:

我的服务托管在远程服务器上,我正在使用本地 Angular js 应用程序中的服务。它在标头中不需要 SessionID 的 REST 请求中运行良好。当我在标题中添加会话 ID 时,它不起作用。给我 404 错误。

app.factory('Dashboard', function($resource, $http) {

return {
GetDashboardData : function(sessionid, id) {
alert(sessionid + '\n' + id);
var config = {
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'SessionID': sessionid
}
};

return $http.post('url goes here'+id,config);

}
}
});

【问题讨论】:

标签: javascript angularjs cross-domain


【解决方案1】:

这是因为您的 rest api 调用中存在跨域问题。您应该对 REST Api 调用进行更改,它会正常工作。您收到 404,因为服务器端不接受会话 ID。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-05-27
    • 1970-01-01
    • 2016-05-07
    • 1970-01-01
    • 2021-03-25
    • 1970-01-01
    • 2022-08-03
    • 2017-06-23
    相关资源
    最近更新 更多