Adding form on the fly and submitting
[code lang=”js”]
function post_to_url(path,params,method){
method=method||"post";
var form=document.createElement("form");
form.setAttribute("method",method);
form.setAttribute("action",path);
for(var key in params){
var hiddenField=document.createElement("input");
hiddenField.setAttribute("type","hidden");
hiddenField.setAttribute("name",key);
hiddenField.setAttribute("value",params[key]);
form.appendChild(hiddenField);
}
document.body.appendChild(form);
form.submit();
}
[/code]
Consume it: <a title=”Title” href=”javascript:post_to_url(‘http://www.domain.com’,{‘rsit’:’3528′,’sit’:’2726′})”>Link</a>