I have an AJAX response that contains some HTML, including <script> elements.
This HTML should replace an existing element, but when I use:
$(element).replaceWith($(response))
I lose the script tags from it…
How can I insert the HTML exactly how it is sent?
This code is from facebook’s sample app. Insert
<div id="fb-root"></div>in your document. The code requires jQuery to load up the script. In your case, replace//connect...../all.js‘ with the<script>elements.