diff --git a/New_APIs/Cat API/index.html b/New_APIs/Cat API/index.html new file mode 100644 index 0000000..84002c3 --- /dev/null +++ b/New_APIs/Cat API/index.html @@ -0,0 +1,40 @@ + + + + + + + Random Cat + + +
+

Loading...

+
+ + + diff --git a/New_APIs/Cat API/manifest.json b/New_APIs/Cat API/manifest.json new file mode 100644 index 0000000..f892853 --- /dev/null +++ b/New_APIs/Cat API/manifest.json @@ -0,0 +1,12 @@ +{ + "name": "Cat facts", + "version": "0.0.1", + "manifest_version": 2, + "browser_action": { + "default_popup": "index.html", + "default_icon": "Cat.png" + }, + "icons": { + "128": "Cat.png" + } +} \ No newline at end of file diff --git a/New_APIs/Cat API/script.js b/New_APIs/Cat API/script.js new file mode 100644 index 0000000..830a9da --- /dev/null +++ b/New_APIs/Cat API/script.js @@ -0,0 +1,10 @@ +document.addEventListener('DOMContentLoaded', () => { + fetch('https://catapi./api/v2/facts') + .then(response => response.json()) + .then(DogData => { + const DogText = DogData.data[0].attributes.body; + const DogElement = document.getElementById('DogElement'); + DogElement.innerHTML = DogText; + }) + .catch(error => console.error('Error fetching the Dog:', error)); +});