Wednesday, November 5, 2014

Make a form "out of thin air" with JavaScript and then post it and its contents.

var form = window.document.createElement("form");
form.setAttribute('method', "post");
form.setAttribute('action', myUrl);
window.document.body.appendChild(form);
var input = document.createElement('input');
input.type = 'hidden';
input.name = 'whatever';
input.value = whatever;
theForm.appendChild(input);
form.submit();

No comments:

Post a Comment