Preview:
<!DOCTYPE html>
<html>
<head>
  <title>XHR Test</title>
</head>
<body>
  <script>
    var xhr = new XMLHttpRequest();
    xhr.open('GET', 'https://jsonplaceholder.typicode.com/posts/1', true);
    xhr.onload = function () {
      if (xhr.status === 200) {
        var data = JSON.parse(xhr.responseText);
        console.log("Response Data:", data); // This should show the post object
        // Optional: shows a popup so you know it worked
        
      } else {
        console.error("Error: " + xhr.status);
      }
    };
    xhr.onerror = function () {
      console.error("Network error");
    };
    xhr.send();
  </script>
</body>
</html>
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter