XML responses from my webapp have both HTML to add to the page AND some have a script to run.
I'm trying to send back XML from my webapp like:
<?xml version="1.0"?> <doc> <html-to-insert> <![CDATA[<p>add me to the page</p>]]> </html-to-insert> <script> <![CDATA[ alert('execute me'); ]]> </script> </doc>
What I'm doing now is snapping out the <html-to-insert> and <script> CDATA, inserting the html into the page and eval'ing <script>.
I'm looking for criticism on my approach. Any suggestions from anyone?