Skip to content

Instantly share code, notes, and snippets.


Filipe Torres filipe-torres

View GitHub Profile
lazamar / loadPageSection.js
Last active Nov 13, 2020
Vanilla JS implementation of JQuery's .load
View loadPageSection.js
* Loads an HTML document from a URL and retuns an element selected using
* the 'selector' parameter
* Example usage:
* loadPageSection('./myPage.html', '#container', (r, err) => console.log(r, err));
* @method loadPageSection
* @param {String} url
* @param {String} selector - A valid CSS selector
* @param {Function} callback - To be called with two parameters (response, error)