Generation

generate functionMon, 17 Jul 2023

Funcion para cargar html de otro archivo html en un div solo con javascript

function cargar(url,div){ if (window.XMLHttpRequest) { xmlhttp=new XMLHttpRequest(); } else { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById(div).innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET",url,true); xmlhttp.send(); return false; }

Javascript
Generate More

Want to kickstart your project?Use the new AI Studio to create your code