I have this code here that ajaxifies my web-application.
$.get(State.url, function(data) {
console.log($(data).find('#main-content').text());
$('#main-content').html($(data).find('#main-content').html());
},"html");
In some certain point the user should upload a file, but since it is ajaxified it will only load the parent container of the incoming response which is this.
<form enctype="multipart/form-data" class="contact_form" action="doUploadAudio">
<input type="file" name="file" value="" id="file"/>
<script>
console.log("HEHE");
$('#fileupload').fileupload({
replaceFileInput:false,
done: function (e, data) {
alert("DONE");
$('#main-content').html('');
$('#main-content').html($(data.result).find('#main-content').html());
}
});
</script>
<button class="btn" id="uploadAudio" type="submit" class="submit" data-loading-text="Uploading...">Upload</button>
</form>
As you can see my form is not executing its script tags, is there anyway I can execute it?
Note that I am currently using jQuery 1.8.3
$(document).ready(function() { $('#fileupload')... });