Problem updating element with script in an AJAX response


I’m trying to use AJAX to update an element with a small HTML fragment
that contains

It does a bunch of document.write()'s. If the fragment is included
inline in an HTML document it works fine, if its in the response to an
AJAX call which is evaluated and used to replace an element on the page,
you see nothing.

Is there some way that this can be made to work?