Got it. My answer to my own questiong and other's responses.
I'm using a perl cgi to access the database and it turns out I didn't even have to use eval. I just insert the script chunk with the inspector code from that database. $("#"+dp_id + " .dp_inspector_code").append( safescript( '<script type="text/javascript">' + inspector_code + '<\/script>' ) ); Note the extra backslash in the closing script tag. Thanks all. ml