-2
I have a field:
<div class="conteudo"></div>
.
I’m wanting to put the text sequinte inside the content div
<p>Conteúdo</p>
.
To try to achieve this goal I am using the following script:
var output=document.querySelector("div.conteudo");
var input=new XMLHttpRequest();
input.open("GET","conteudo.html")
input.addEventListener("load",function(){
output.innerHTML=input.responseText;
})
input.send();
.
But I’m getting the following error:
Access to Xmlhttprequest at 'file://D:/test/conteudo.html' from origin 'null' has been blocked by CORS policy: Origin cross requests are only supported for Protocol schemes: http, data, Chrome, Chrome-Extension, Chrome-untrusted, https.
.
How do I load html objects dynamically using javascript?