我无法使用CORS和AngularJS进行删除 [英] I can't make a DELETE with CORS and AngularJS

查看:76
本文介绍了我无法使用CORS和AngularJS进行删除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用AngularJS进行DELETE请求.

I'm trying to make a DELETE request with AngularJS.

我正在从服务器发送此标头:

I'm sending this headers from the Server:

header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Headers: origin, x-requested-with, content-type, accept');
header('Access-Control-Allow-Method: GET, POST, OPTIONS, DELETE');

但是在Chrome浏览器中,当我执行

But in Chrome, when I do an

$http({method: 'DELETE', url: EmployeesURL + "remove/id/" + id}) 

它会抛出 Access-Control-Allow-Methods不允许的方法DELETE.错误.

推荐答案

好像您缺少一个's'Access-Control-Allow-Methods

Looks like you are missing an 's' Access-Control-Allow-Methods

这篇关于我无法使用CORS和AngularJS进行删除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆