Here I want to post an example to show how this post request can be generated from within a dynamically generated iframe. This would be useful for showing a chart using dynamic data which, say, are downloaded from another page using ajax request (prototype library is used).
This is how the DOM document might look like:
<div id="outerdiv" width="700" height="400"> </div>
and the javascript code:
var fstr = "<iframe src='' id='gchart_frame' width='710' height='410'></iframe>" ; var formstr = "<form id='gchart_form'" + " action='http://chart.apis.google.com/chart?chid=" + Math.random() + "' method='POST'>" ; // random chid to prevent browser caching formstr += "<input type='hidden' name='cht' value='lc'/>" ; formstr += "<input type='hidden' name='chs' value='700x400'/>" ; formstr += "<input type='hidden' name='chd' value='t:0,1,2,3,5,123" ; // put your data here, can be dynamically downloaded from an ajax source. formstr +="<input type='hidden' name='chxt' value='x,y'/>" ; formstr +="<input type=\"submit\"/></form>" ; $('outerdiv').innerHTML = fstr ; // embed the iframe ($) is from prototype library var ff = $('gchart_frame') ; if (! Prototype.Browser.IE) { // for other browsers var y=(ff.contentWindow || ff.contentDocument); if (y.document) y=y.document; y.body.innerHTML = formstr; y.forms[0].submit() ; // load the chart within the iframe } else { // IE var ffs = document.frames["gchart_frame"] ; var divn = ffs.document.createElement('div') ; divn.innerHTML = formstr; ffs.document.appendChild(divn) ; var gchartform = ffs.document.getElementById('gchart_form') ; gchartform.submit() ; }