generated from dwd/boilarplate-astro-tailwind
pull/4/head
parent
c5f3ddf301
commit
c7d1ac2749
|
@ -0,0 +1,15 @@
|
||||||
|
<div>
|
||||||
|
<button onclick="fetchData()">Fetch Data</button>
|
||||||
|
</div>
|
||||||
|
<script is:inline>
|
||||||
|
function fetchData(){
|
||||||
|
fetch(`https://dummy.restapiexample.com/api/v1/employees`)
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(data => {
|
||||||
|
console.log(data)
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.error(error)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</script>
|
Loading…
Reference in New Issue