<script type="text/javascript">
function submitForm(url, data)
{
var eleForm = document.body.appendChild(document.createElement(‘form‘));
eleForm.action = url;
for (var property in data)
{
var hiddenInput = document.createElement(‘input‘);
hiddenInput.type = ‘hidden‘;
hiddenInput.name = property;
hiddenInput.value = data[property];
eleForm.appendChild(hiddenInput);
}
this.eleForm = eleForm;
if (!submitForm._initialized)
{
submitForm.prototype.post = function ()
{
this.eleForm.method = ‘post‘;
this.eleForm.submit();
};
submitForm._initialized = true;
}
}
function Onclick()
{
//location.href = "/Activity/ActivityInformation?a_id=" + "1"; // Url中会带有参数
new submitForm(‘/Activity/ActivityInformation‘, { a_id: "1" }).post(); // Url中的参数被隐藏
}
</script>