JavaScript post request like a form submit shows you how to submit a form that you create via POST in JavaScript. Below is my modified code.
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();
What I would like to do is open the results in a new window. I am currently using something like this to open a page in a new window:
onclick = window.open(test.html, '', 'scrollbars=no,menubar=no,height=600,width=800,resizable=yes,toolbar=no,status=no');
Add
<form target="_blank" ...></form>
or
form.setAttribute("target", "_blank");
to your form's definition.