フォーム送信のようなJavaScriptポストリクエストは、 JavaScriptのPOSTを介して作成したフォームを送信する方法を示しています。以下は私の変更したコードです。
var form = document.createElement("form");
form.setAttribute("method", "post");
form.setAttribute("action", "test.jsp");
var hiddenField = document.createElement("input");
hiddenField.setAttribute("name", "id");
hiddenField.setAttribute("value", "bob");
form.appendChild(hiddenField);
document.body.appendChild(form); // Not entirely sure if this is necessary
form.submit();
結果を新しいウィンドウで開きます。私は現在、次のようなものを使用して新しいウィンドウでページを開いています。
onclick = window.open(test.html, '', 'scrollbars=no,menubar=no,height=600,width=800,resizable=yes,toolbar=no,status=no');
document.body.appendChild(form)
され、必要に応じて参照stackoverflow.com/q/42053775/58241