JavaScript AJAX Basics (retiring) AJAX Concepts A Simple AJAX Example

Martin Park
Martin Park
12,792 Points

Resolving this using fetch()

At the end of the fetch workshop. Guil suggests retracing your steps and using fetch() to complete these earlier workshops.

In case this helps anyone out there, the following code gets the same results using fetch():


  .then(response => response.text())
  .then(response => sendAJAX = () =>{
    document.getElementById('ajax').innerHTML = response;
    document.getElementById('load').style.display = "none";

Steven Parker
Steven Parker
201,345 Points

:information_source: For those interested in "fetch" who find this through the AJAX course,
    the separate fetch workshop mentioned here is Working with the Fetch API.