JSFiddle - React, Tailwind, and code Playground

by velo_ninja

HTML

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Get Data from Function</title>
</head>

<body>
    <button onclick="getData()">Click to Get Data</button>

    <script>
     
     
     
     const url = "https://www.media-junkie.com/_functions/filter?database=Team";

fetch(url)
  .then(response => {
    if (!response.ok) {
      throw new Error(`Network response was not ok: ${response.status}`);
    }
    return response.json();
  })
  .then(data => {
    console.log(data);
    // Handle the data as needed
  })
  .catch(error => {
    console.error('Error fetching data:', error);
  });
     
     
     
    </script>
</body>

</html>