This is a simple HTML page that fetches data from the Star Wars API (SWAPI) and displays it in a formatted JSON format.
Click here to view the live version of this project.
The page fetches data from the SWAPI using JavaScript's fetch
API, parses the JSON response, and displays it in a <div>
element. If an error occurs during the fetch operation, an error message is displayed instead.
- Fetches JSON data from the SWAPI.
- Displays the fetched JSON data in a readable, formatted manner.
- Shows an error message if the fetch operation fails.
-
Clone the Repository (if applicable):
git clone https://github.com/your-username/swapi-data-fetcher.git cd swapi-data-fetcher
-
Open the HTML File: Open
index.html
in your web browser. -
View Data: The fetched data from SWAPI will be displayed in the browser. If there's an error with fetching the data, an error message will be shown.
- HTML: The page contains a
<div>
element with the IDcontent
where the fetched data is displayed. - CSS: Basic styling is applied to the page and the data display.
- JavaScript:
- Fetches data from the SWAPI.
- Parses the JSON response.
- Displays the data in the
#content
element. - Handles errors and displays error messages.