I have an ajax POST request, this request comes with html with <script src="">
tags referencing external js files, when I insert this html in DOM the JS are not loaded, what I'm doing wrong? I can remember see this working loading the external script1 and script2 without problems.
Request:
$.ajax({
type: 'POST',
dataType: 'xml/html',
cache: false,
url: "/html/with/scripttags",
data: {somedata:'value'},
success: function(data) {
$('body').append(data)
}
});
Content loaded:
<link rel="stylesheet" media="all" href="http://domain.com/application.css" />
<script src='http://domain.com/script.js' type='text/javascript'></script>
<script src='http://domain.com/script2.js' type='text/javascript'></script>
<script type='text/javascript'>alert('executed')</script>
<div>BLAALBLABLAB</div>
However the alert in script tag is is executed without problems and the application.css
external file is loaded without problems. Looks like jQuery doesn't load the files, I also check the network tab..