无法正确读取http请求
Can not read http request properly
我正在尝试使用 axios 更新数据,我想在请求中使用“id”url
像 http:///localhost/api/firstmemory/1
但是return 500 Internal Server Error,因为我的id没有正确读取。
我的代码
const id = detail.id;
const updateFirstInfo = (e) => {
const upInfo = {
first: first,
date: change,
memo: memo,
}
console.log(id); //1
axios
.put(`api/firstmemory/${id}}`, upInfo)
.then(res => {
console.log("ok");
})
.catch(err => {
alert("err");
});
};
我该如何解决?
%7D
是字符 }
的 HTML 编码。如果仔细观察,您会发现在使用模板字符串的地方有一个额外的 }
。删除多余的 }
:
axios
.put(`api/firstmemory/${id}`, upInfo)
.then(res => {
console.log("ok");
})
.catch(err => {
alert("err");
});
希望对您有所帮助!
我正在尝试使用 axios 更新数据,我想在请求中使用“id”url 像 http:///localhost/api/firstmemory/1
但是return 500 Internal Server Error,因为我的id没有正确读取。
我的代码
const id = detail.id;
const updateFirstInfo = (e) => {
const upInfo = {
first: first,
date: change,
memo: memo,
}
console.log(id); //1
axios
.put(`api/firstmemory/${id}}`, upInfo)
.then(res => {
console.log("ok");
})
.catch(err => {
alert("err");
});
};
我该如何解决?
%7D
是字符 }
的 HTML 编码。如果仔细观察,您会发现在使用模板字符串的地方有一个额外的 }
。删除多余的 }
:
axios
.put(`api/firstmemory/${id}`, upInfo)
.then(res => {
console.log("ok");
})
.catch(err => {
alert("err");
});
希望对您有所帮助!