I am using $.get() to retrieve an HTML snippet from a remote server and insert that snippet into the DOM. The snippet contains several basic HTML elements and a script element. All of the basic elements get inserted, but the script element does not.
Example snippet:
<p>This is a paragraph</p>
<script type="text/javascript">
// JavaScript that will work with the HTML in the snippet
</script>
I have verified that the script element is in the retrieved snippet by looking at the resources retrieved in Chrome's web inspector. So, why doesn't $.get() insert the script element and is it possible to do what I am wanting to do?
Edit:
To clarify, I was retrieving the HTML snippet with $.get() and inserting it into the DOM with $().html(data).