I use $.get()to extract the HTML fragment from the remote server and paste this fragment into the DOM. The snippet contains several basic HTML elements and a script element. All base elements are inserted, but the script element does not work.
Fragment example:
<p>This is a paragraph</p>
<script type="text/javascript">
</script>
I checked that the script element is in the extracted snippet, looking at the resources received in the Chrome web inspector. So why $.get()not insert a script element and is it possible to do what I want to do?
Edit:
To clarify, I extracted the HTML fragment with $.get()and pasted it into the DOM with $().html(data).
source
share