【发布时间】:2020-08-16 04:04:15
【问题描述】:
我正在使用 axios.post() 在我的 Reactjs 应用程序的后端编辑一个 mysql 数据库。数据可以通过 post 请求到达后端。但是我需要知道发布请求何时完成并从中返回一些数据,以了解后端代码运行是否正常。我尝试了以下方法,其中 newEdit 是一个对象,其中包含后端所需的信息
axios
.post('http://ip:3001/edit_table', newEdit)
.then((response) => {
console.log("response: ",response);
}, (error) =>{
console.log("error: ",error)
});
控制台日志语句均未运行。再一次,该对象确实可以很好地访问路由的 nodejs 文件,但我无法得到任何类型的响应。有谁知道发生了什么?谢谢。
【问题讨论】: