I'm trying to alert(); the response for a webpage. But the alert popup is blank. The HTTP request returns status 200 and I can see the response HTML in the browser console Network tab.
I've tried examples shown here, here, and here. The alert window is always blank...
What am I getting wrong here? (I'm new to JS).
<!DOCTYPE html>
<html lang="en">
   <body>
      <script type="text/javascript">
        var xhr = new XMLHttpRequest();
        xhr.open("GET", "https://website.com/page", true);
        xhr.withCredentials = true;
        xhr.send();
        
        alert(xhr.response);
        alert(xhr.responseText);
      </script>
   </body>
</html>
