반응형

<div data-include-path="include/html/inc_left.html"></div>

 

 

 

window.addEventListener('load'function() {

    var allElements = document.getElementsByTagName('*');

    Array.prototype.forEach.call(allElementsfunction(el) {

        var includePath = el.dataset.includePath;

        if (includePath) {

            var xhttp = new XMLHttpRequest();

            xhttp.onreadystatechange = function () {

                if (this.readyState == 4 && this.status == 200) {

                    el.outerHTML = this.responseText;

                }

            };

            xhttp.open('GET'includePathtrue);

            xhttp.send();

        }

    });

});

728x90
반응형

+ Recent posts