Mark is correct.
Additionally, if you wish to test API endpoints without a browser then you can use getpostman.com
Also, these resources may help
gomakethings.com/ajax-and-apis-with-vanilla-javas…
developer.mozilla.org/en-US/docs/Web/Guide/AJAX
developer.mozilla.org/en-US/docs/Web/API
seguetech.com/ajax-technology