http-delete 相关问题

DELETE是一种HTTP请求方法,用于删除服务器端的指定资源。

删除对 Modeshape 休息服务器的请求

我正在使用 Modeshape 休息服务器。 Modeshape的版本是2.8.2。 当我向 http://localhost:8080/modeshape-server/repo/workspace1/items/file 等节点发送 GET 请求时,它会返回信息 abo...

回答 1 投票 0

在启用 no-cors 的情况下使用 Fetch api DELETE 方法

我正在尝试发出删除后端实体的 API 请求。我的 spring 服务器和 node.js 服务器在不同的端口上运行。 当我在启用 cors 的情况下尝试提取请求时(模式:&q...

回答 2 投票 0

如何批量删除Auth0租户中的所有用户?

我想通过删除所有用户来有效地“重置”用于测试目的的 Auth0 租户之一。 根据社区论坛,似乎没有办法做到这一点。 正在删除...

回答 1 投票 0

遇到内部服务器错误 - 如何在我的 Web 应用程序中排查并解决此问题?

App.jsx:39 删除餐厅时出错。服务器返回 500 内部服务器错误 我正在构建一个使用 Flask 后端 API 的 React 应用程序,当我尝试从前端删除时,它会保留...

回答 1 投票 0

删除请求未获取授权标头

我的后端是 NodeJs 和 Express。我的 90% 的端点都经过 validateToken 中间件并且运行良好,但我创建了一个删除端点,由于某种原因它没有得到

回答 1 投票 0

当我使用Javascript单击删除按钮时,如何从DOM中删除TODO项目列表?

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>TODO app</title> </head> <script> function deleteDone(id) { console.log("Deleted todo ID:", id); // Delete the right todo from the list // You will need to give each todo an id, and that should be enough to remove it } function deleteTodo(id) { fetch("http://localhost:3000/todos/" + id, { method: "DELETE", headers: { "Content-Type": "application/json" } }).then(deleteDone) } function getTodoscallBack(data){ console.log(data); var parentElement = document.getElementById("mainArea"); // parentElement.innerHTML = JSON.stringify(data); for(var i=0;i<data.length;++i){ var childElement = document.createElement("div"); var grandChildren1 = document.createElement("span"); grandChildren1.innerHTML= data[i].title; var grandChildren2 = document.createElement("span"); grandChildren2.innerHTML= data[i].description; var grandChildren3 = document.createElement("button"); grandChildren3.innerHTML="Delete"; grandChildren3.setAttribute("onclick","deleteTodo("+data[i].id+")"); childElement.appendChild(grandChildren1); childElement.appendChild(grandChildren2); childElement.appendChild(grandChildren3); parentElement.appendChild(childElement); } } function callbackFn2(res){ res.json().then(getTodoscallBack); } function getData(){ fetch("http://localhost:3000/todos",{ method:"GET", }).then(callbackFn2); } getData(); function parsedResponse(data){ console.log(data); var parentElement = document.getElementById("mainArea"); var childElement = document.createElement("div"); var grandChildren1 = document.createElement("span"); grandChildren1.innerHTML= data.title; var grandChildren2 = document.createElement("span"); grandChildren2.innerHTML= data.description; var grandChildren3 = document.createElement("button"); grandChildren3.innerHTML="Delete"; childElement.appendChild(grandChildren1); childElement.appendChild(grandChildren2); childElement.appendChild(grandChildren3); parentElement.appendChild(childElement); } function callback(res){ res.json().then(parsedResponse); } function onPress(){ var title = document.getElementById("title").value; var description = document.getElementById("description").value; console.log(title,"\n",description); fetch("http://localhost:3000/todos",{ method:"POST", body: JSON.stringify({ title: title, description:description }), headers: { "Content-Type": "application/json" } }).then(callback); } </script> <body> Todo title <input type="text" id="title"></input> <br><br> Todo description <input type="text" id="description"></input> <br><br> <button onclick="onPress()">send todo</button> <div id="mainArea"> </div> </body> </html> 在 TODO 项目的删除功能中,我想删除具有给定 id 的特定待办事项,但我在选择父级(即 div 标签)时遇到困难,其中我存储了标题描述和删除按钮,我通过使用 javascript 发送请求来添加该按钮。问题如何使用removeChild()删除具有id的特定删除按钮的div标签?如何做到这一点? 我复制了与您完全相同的代码,并传递了一个伪造的数组来建模待办事项,就像您已经做的那样 const todos = [{ id: 1, title: 'title#1', description: 'description#1' }, { id: 2, title: 'title#2', description: 'description#2' }]; 为了与您的策略保持一致,在创建待办事项的逻辑中,我添加了使用相应的待办事项 id 设置每个删除按钮的 data-id 属性的功能,然后在 deleteDone 函数中我获取了单击的删除使用属性选择器按钮,然后删除使用 div 检索到的整个 closest 容器。 const todos = [{ id: 1, title: 'title#1', description: 'description#1' }, { id: 2, title: 'title#2', description: 'description#2' }]; getTodoscallBack(todos); function deleteDone(id) { console.log("Deleted todo ID:", id); //retrieves the delete button holding the data-id attribute passed const delButton = document.querySelector(`[data-id="${id}"`); //retrieves the element containing that button const todoContainer = delButton.closest('div'); //removes the whole div containing the todo todoContainer.remove(); } function deleteTodo(id) { /* fetch("http://localhost:3000/todos/" + id, { method: "DELETE", headers: { "Content-Type": "application/json" } }).then(deleteDone) */ deleteDone(id); } function getTodoscallBack(data) { console.log(data); var parentElement = document.getElementById("mainArea"); // parentElement.innerHTML = JSON.stringify(data); for (var i = 0; i < data.length; ++i) { var childElement = document.createElement("div"); var grandChildren1 = document.createElement("span"); grandChildren1.innerHTML = data[i].title; var grandChildren2 = document.createElement("span"); grandChildren2.innerHTML = data[i].description; var grandChildren3 = document.createElement("button"); grandChildren3.innerHTML = "Delete"; grandChildren3.setAttribute("onclick", "deleteTodo(" + data[i].id + ")"); //HERE I set the data-id attribute value as data[i].id grandChildren2.dataset.id = data[i].id; childElement.appendChild(grandChildren1); childElement.appendChild(grandChildren2); childElement.appendChild(grandChildren3); parentElement.appendChild(childElement); } } function callbackFn2(res) { res.json().then(getTodoscallBack); } function getData() { fetch("http://localhost:3000/todos", { method: "GET", }).then(callbackFn2); } getData(); function parsedResponse(data) { console.log(data); var parentElement = document.getElementById("mainArea"); var childElement = document.createElement("div"); var grandChildren1 = document.createElement("span"); grandChildren1.innerHTML = data.title; var grandChildren2 = document.createElement("span"); grandChildren2.innerHTML = data.description; var grandChildren3 = document.createElement("button"); grandChildren3.innerHTML = "Delete"; childElement.appendChild(grandChildren1); childElement.appendChild(grandChildren2); childElement.appendChild(grandChildren3); parentElement.appendChild(childElement); } function callback(res) { res.json().then(parsedResponse); } function onPress() { var title = document.getElementById("title").value; var description = document.getElementById("description").value; console.log(title, "\n", description); fetch("http://localhost:3000/todos", { method: "POST", body: JSON.stringify({ title: title, description: description }), headers: { "Content-Type": "application/json" } }).then(callback); } <body> Todo title <input type="text" id="title"> <br><br> Todo description <input type="text" id="description"> <br><br> <button onclick="onPress()">send todo</button> <div id="mainArea"> </div> </body>

回答 1 投票 0

IIS7.5 尝试使用 DELETE 动词时出现 500 内部服务器错误

我正在尝试对 IIS7.5 资源发出 DELETE: 删除 http://198.252.206.16:48251/Test/foo.ashx HTTP/1.1 接受: */* 接受语言:en-us 接受编码:gzip、deflate 用户代理:Mozilla...

回答 4 投票 0

Javascript:获取 DELETE 和 PUT 请求

我已经摆脱了使用 Fetch 的 GET 和 POST 方法。但我找不到任何好的 DELETE 和 PUT 示例。 所以,我向你要这个。你能给出一个关于 DELETE 和 PUT 方法的很好的例子吗...

回答 10 投票 0

DELETE 索引命令返回不同的 JSON 对象

(ES 8.6.2,W10) 在 Insomnia 中,当我尝试使用命令 DELETE 和 url https://localhost:9500/my_test_index 删除不存在的索引时,我似乎总是得到如下 JSON 对象: { “……

回答 1 投票 0

InvalidDataAccessApiUsageException:(“无法找到持久器:java.lang.Integer”)在 Spring Boot 中的 Http DELETE 请求

我正在为我的 flutter 费用跟踪器应用程序创建一个 REST API。其他每个 http 请求都有效,但是当我发出 DELETE 请求时,它会给我 InvalidDataAccessApiUsageException 用户实体: 包com.

回答 1 投票 0

如何在 HTTP DELETE 请求中发送复合主键?

我的数据库中有一个链接表,其中有两列:event_id 和 user_id。两者都是外键,它们一起形成复合主键。 通常,当向我的 api 发送 DELETE 请求时,...

回答 1 投票 0

我如何通过其API删除loki中的所有日志?

在使用 loki api 时,我很难为我们的应用程序的“删除全部”按钮实现一个干净的解决方案。 设置:Loki 在集群中处于整体模式。 目标:Loki 接受一个 api...

回答 1 投票 0

在删除函数中获取未定义的id

我正在尝试编写一个删除函数来从我的对象中删除测验。 这是我的代码,但是当我单击删除按钮时,我收到 DELETE: Error。 您认为我的代码中有什么错误? 你可以...

回答 1 投票 0

如何在链接或表单中指定DELETE方法?

Rfc2616 列出了除 GET 和 POST 之外的许多方法,例如 DELETE、PUT 等。但是,html 表单中的 Method 字段似乎只允许指定 GET 或 POST。 是否可以创建一个链接或...

回答 8 投票 0

Next.js 13 DELETE 请求“语法错误:JSON 输入意外结束”

我有一个使用 Next 13 的 Web 应用程序,其 api 文件夹下有一个 Route.ts 文件 目前包含 2 种不同的方法 POST 和 DELETE。 两种方法都成功接收请求,但是当尝试...

回答 1 投票 0

删除脚本在我的模板中没有按预期工作

我有一个 html 页面应该显示用户帐户的博客(所以有一个帐户集群,一个博客集群,并且该帐户有一个博客字段,将相关博客存储在一个数组中)和...

回答 1 投票 0

Express.js PUT 和 DELETE 方法不起作用

我正在尝试使用 Node、Express 和 sqlite3 创建一个简单的待办事项应用程序。我有一个完美运行的 GET 和 POST 方法,但是我的 PUT 和 DELETE 没有被访问,相反我遇到了 404

回答 1 投票 0

用javascript删除json值

我已经尝试了很多方法,但我被一个简单的javascript函数卡住了,我不知道我需要在哪里寻找...问题是这样的。我有一个像这样的Json文件。{ "...

回答 1 投票 0

Microsoft Graph API,DELETE请求响应错误代码403""访问被拒绝。检查凭证并再次尝试。"

我正在开发一个Microsoft Graph API应用程序,我想从收件箱中删除邮件信息。我的做法是首先获取邮件,将每封邮件的id放在一个数组中,然后对每个id在...

回答 1 投票 0

我们可以将参数传递给HTTP DELETE api

我有一个将删除资源的API(DELETE / resources / {resourceId})。上述API仅能告诉我们删除资源。现在,我想将API扩展到其他用例,例如进行备份...

回答 1 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.