Load Remote Content Via AJAX – httploader.js

Category: Javascript , Loading | January 15, 2021
Author:mirkobrombin
Views Total:405 views
Official Page:Go to website
Last Update:January 15, 2021
License:MIT

Preview:

Load Remote Content Via AJAX – httploader.js

Description:

httploader.js is a super tiny and dependency-free JavaScript library for loading remote content via AJAX requests.

The library gives the ability to fetch HTML content via a URL and inject it into your current page.

How to use it:

1. Load the main script httploader.js in the document.

<script src="httploader.js"></script>

2. Load an external page into a given container.

<div id="data"></div>
var data = document.getElementById("data");
load(data, "ajax.html");
// ajax.html
<h2>Loaded Via AJAX</h2>

3. Or load part of the external page.

load(data, "ajax.html", "body > h2");

You Might Be Interested In:


Leave a Reply