0
I have an administrative system using adminLTE. In the side menu I load all my scripts asynchronously (at least it was expected). However when I load an HTML asynchronously, and inside this file I load an external javascript, it generates 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 https://xhr.spec.whatwg.org/.
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 carry is this:
<div class="box">
<h1>HTML carregado assincronamente</h1>
</div>
<script src="meuScript.js"></script>
Placing the javascript code directly in the HTML file does not generate any error.
<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?
You’re confusing synchronous with asynchronous!
– bfavaretto