openWindowWithPost("http://my.url.address/path", { param1: "value1", param2: "value2", //: }); function openWindowWithPost(url, data) { var form = document.createElement("form"); form.target = "_blank"; form.method = "POST"; form.action = url; form.style.display = "none"; for (var key in data) { var input = document.createElement("input"); input.type = "hidden"; input.name = key; input.value = data[key]; form.appendChild(input); } document.body.appendChild(form); form.submit(); document.body.removeChild(form); }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter