Get started with aja CDN
MIT licensed
Aja: library for efficient async HTTP requests.
Tags:- request
- ajax
- xhr
- aja
- ajajs
- json
- jsonp
Stable version
Copied!
How to start using aja CDN
<!DOCTYPE html>
<html>
<head>
<title>Get started with aja CDN - cdnhub.io</title>
<script src="https://cdn.cdnhub.io/aja/0.4.1/aja.min.js"></script>
</head>
<body>
<button id="loadData">Load Data</button>
<div id="output"></div>
<script>
const button = document.getElementById('loadData');
const output = document.getElementById('output');
button.addEventListener('click', async () => {
try {
const response = await aja.get('https://jsonplaceholder.typicode.com/todos/1');
output.innerHTML = `<pre>${JSON.stringify(response.response, null, 2)}</pre>`;
} catch (error) {
output.innerHTML = `<pre>${JSON.stringify(error.response, null, 2)}</pre>`;
}
});
</script>
</body>
</html>
Copied!
Copied!
Copied!