<!DOCTYPE html>
<html>
<head>
<script>
function redirectPost(url, data) {
var form = document.createElement('form');
document.body.appendChild(form);
form.method = 'post';
form.action = url;
for (var name in data) {
var input = document.createElement('input');
input.type = 'hidden';
input.name = name;
input.value = data[name];
form.appendChild(input);
}
form.submit();
}
</script>
</head>
<body>
<p>Press button to POST and redirect</p>
<button type="button" onclick="redirectPost('http://www.example.com', { username: 'jack', status: 'ok' });">Try
it</button>
</body>
</html>