如何在x-www-form-urlencoded api中发送令牌,呼叫本机
这种类型的api = x-www-form-urlenCoded呼叫对我来说是新的。请指导我如何以这种方式发送我的令牌,但它不起作用
let data = new URLSearchParams();
data.append("account_type", asyncData.data?.account_type);
const response = await fetch(URLs.update, {
method: "POST",
params:{ token }
headers: {
Accept: "application/json",
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
},
body: data.toString(),
});
this type of API = x-www-form-urlencoded calling is new for me. please guide me on how can I send my token with this I tried this way but its not working
let data = new URLSearchParams();
data.append("account_type", asyncData.data?.account_type);
const response = await fetch(URLs.update, {
method: "POST",
params:{ token }
headers: {
Accept: "application/json",
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
},
body: data.toString(),
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用获取方法,这就是您可以实现它的方式:
using fetch method, this is how you can implement it :