Here we use a JavaScript function:
function cmd(suffix) {
document.getElementById("pymol_response_iframe").src =
"/apply/pymol.cmd." + suffix +
( suffix.indexOf('?') < 0 ? '?' : '&') +
"_ts=" + new Date().getTime(); // cache avoidance
}
to convert our query suffix into a unique URL and the populate the IFRAME src field, thereby generating a pymol method request. PyMOL's response ends up in the IFRAME.
load: cmd('load?filename=$PYMOL_PATH/test/dat/1tii.pdb')
count_atoms: cmd('count_atoms')
reinitialize: cmd('reinitialize')