User-474980206 posted
if you are already using jQuery, then use its ajax. If you are not using jQuery, then you want to use the native fetch (use pollyfill for older browsers) or the dedicated ajax library axios.
https://github.com/axios/axios
I typically use fetch. jQuery, axios and fetch all use promises, so you can use async/await
const response = await fetch(`https://api.github.com/users/${name}`);
const data = await response.json()