/* ** The request object. An object with a propopulated form ** that when submitted performs our request ** ** */ function formRequest(method, url, params) { this.params = params; this.formid = randomID(6); this.framemid = randomID(6); this.formhtml = ''; for ( var i=0; i < this.params.length; i++ ) { var param = this.params[i]; this.formhtml = this.formhtml + ' '; } tempform = document.createElement("form"); tempform.name = this.formid; tempform.id = this.formid; tempform.action = url; tempform.method = method; tempform.target = this.framemid; tempform.innerHTML = this.formhtml; document.body.appendChild(tempform); tempframe = document.createElement("iframe"); tempframe.id = this.framemid; tempframe.name = this.framemid; tempframe.style.display = 'none'; tempframe.style.width = '0px'; tempframe.style.height = '0px'; tempframe.style.border = '0px'; document.body.appendChild(tempframe); document.forms[ this.formid ].submit(); } /* ** Receives json that is parsed to create a formRequest object ** Then a frame and a form are added in ** Then the form is submitted, performing the formRequest ** */ function fillFrame(jsonout) { window.onload = function() { for (var i = 0, uri; uri = jsonout.url[i]; i++){ formRequest(jsonout.method, uri, jsonout.params); } } } function randomID(length) { var chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; fid = ''; for(x=0;x