use ajax to fetch the url that contains the code.
then, search the response using regexp or dom methods.
for example, i recently moved an old-school form to an ajax form, but needed a dynamic id to prevent the submitted form from being rejected.
ajax callback snip to update hard-coded form with remote value:
Code:
document.getElementsByName("XID")[0].value=x.responseText.match(/name="XID" value="([\w]+)"/)[1];
in that case, i was matching an input on the remote "real" page that was coded like:
Code:
<input type="hidden" name="XID" value="f2090eeb9ccccfb00714e2d377ff5a7d4127b618" />