如何使用Fetch模拟表单提交?

我需要使用Fetch API模拟表单提交,但我还无法正常工作

这是我的代码:

const headers = new Headers({
 'Content-Type': 'application/x-www-form-urlencoded','accept-language': 'en-US','cache-control': 'max-age=0',});

 fetch(`/actions`,{
    method: 'POST',headers: headers,body: new URLSearchParams(anObject).toString(),});

这是我要模仿的形式

<form action="/actions" method="POST" enctype="application/x-www-form-urlencoded" target="_self">

我仍然不知道如何将target属性添加到Fetch中。我不知道我在这里还缺少什么。

如果您还知道使用其他工具模拟表单提交的其他方法,请告诉我。

预先感谢

huilovenai 回答:如何使用Fetch模拟表单提交?

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3148916.html

大家都在问