Skip to content

Instantly share code, notes, and snippets.

Avatar

Filipe Torres filipe-torres

View GitHub Profile
@lazamar
lazamar / loadPageSection.js
Last active May 21, 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)
You can’t perform that action at this time.