If not, is there an alternative solution?
Consider the following:
Page 1:
<script>
var placeholder = '';
*** Perform an AJAX Request to Page 2 ***
document.write(placeholder);
</script>
Page 2:
<script>placeholder = "data for testing";</script>