generated from dwd/boilarplate-astro-tailwind
s1
This commit is contained in:
15
src/pages/test2.astro
Normal file
15
src/pages/test2.astro
Normal file
@@ -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>
|
||||||
Reference in New Issue
Block a user