This is a simple web application that generates random user information using the Random User Generator API. The application is built using HTML, CSS (Bootstrap), and JavaScript. It fetches random user data asynchronously, and on the click of a button, it displays the user information dynamically on the webpage.
- Open the
index.html
file in a web browser. - Click the "Generate New Random User" button to fetch and display a new random user.
Check out the live demo here.
- HTML
- CSS (Bootstrap 5.0.2)
- JavaScript (Async/Await, Fetch API)
index.html
: The main HTML file that contains the structure of the webpage.main.js
: The JavaScript file that handles the logic for fetching and displaying random user data.styles.css
: Inline styles for the HTML document.
- The web page includes a "Generate New Random User" button and a card element (
displayCard
) to display the user information. - The JavaScript code (
main.js
) contains an asynchronous function (newRandomUser
) that fetches random user data from the Random User Generator API using thefetch
API andasync/await
. - The fetched data is then dynamically inserted into the HTML document to update the user interface.
The project uses Bootstrap for styling to achieve a clean and responsive design. Custom styles are also applied to enhance the visual appearance.
The application includes error handling for cases where fetching the random user data fails. If an error occurs, it is logged to the console, and an error message is not displayed on the webpage.
[Gaurav Mazumdar]
Feel free to customize this README file based on your preferences and provide more details if needed.