Category: Javascript

Posted on: June 1, 2012 Posted by: John Huh Comments: 0

jQuery Widget Factory

Links about jQuery widget factory: http://wiki.jqueryui.com/w/page/12138135/Widget%20factory http://blog.nemikor.com/tag/widget-factory/ http://docs.jquery.com/Plugins/Authoring

Posted on: October 1, 2010 Posted by: John Huh Comments: 0

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>