I have an administrative system using adminLTE. In the side menu I load all my scripts asynchronously (at least it was expected). But when I load an HTML asynchronously, and inside that file I load an external javascript, it gives me the following warning:
jquery.min.js: 2 [Deprecation] Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check link .
Follow the code I'm using to load the files
$.ajax(url+"teste").done(function(data) {
$("#ajax-content").html(data);
$('#loadingMenu').remove(); // Retira o gif de loading
});
The file I load is this:
<div class="box">
<h1>HTML carregado assincronamente</h1>
</div>
<script src="meuScript.js"></script>
Placing the direct javascript code in the HTML file does not generate any errors.
<div class="box">
<h1>HTML carregado assincronamente</h1>
</div>
<script>
alert('agora não gera aviso');
</script>
How do I load this script without having to put it on the same HTML page?