is the following safe?
index.html
<div id="loader">loading...</div>
<div onclick="foo()">click me</div>
<div id="change"></div>
<script>
function foo(){
jQuery.ajax({
url: 'get.html',
success: function(txt){
var x = $('#loader').html(txt)
x=$('loader').find('script').html()
eval(x)
}
})
}
</script>
get.html
<div>Header</div>
<script>
function newfoo(){
$('#change').html('hello world')
}
</script>
in theory this should work....
note: above may not work it's a demonstration only...
my question is: as the newFoo() will not be run by itself when the get.html is loaded due to some security reasons... would the above alternative pose any security threat?