Да.Вам нужно получить форму из тела документа, создать объект FormData, установить значения полей и отправить запрос POST.
Для простоты я использовал Fetch API: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API. Я также предположилчто учетные данные также необходимо было передать из того же источника.
fetch('<GET URL>', {method: "GET", credentials: 'same-origin'})
.then((response) => (response.text()))
.then((responseBody) => {
var html = htmlBody(responseBody);
var form = html.querySelector('#my-form'); // whatever your form is called
var formData = new FormData();
formData.append('someName', 'someValue'); // the field name will probably come from your form fields
postForm(formData)
.then((response) => (response.text()))
.then((responseBody) => {
// whatever with the form post response
});
})
function htmlBody(string) {
var document = new DOMParser;
return document.parseFromString(string, 'text/html').body;
}
function postForm(formData) {
return fetch('<POST URL>', {
method: 'POST',
body: formData,
credentials: 'same-origin'
})
}