This is a simple web application that fetches a random user from the RandomUser.me API and displays their basic information such as photo, name, email, phone number, and location.
Only female users are displayed based on the filter added in the code.
- Fetches a random user using
fetch()API - Displays:
- π€ User Photo
- π Name
- π§ Email
- π± Phone
- π Location
- Shows user only if
gender = female - Simple and clean UI
- One-button user generator
The app fetches data from:
https://randomuser.me/api/
It extracts the first object from the results array and updates the UI.
fetch('https://randomuser.me/api/')
.then(res => res.json())
.then(data => {
let user = data.results[0];
if (user.gender === 'female') {
document.getElementById("photo").src = user.picture.large;
document.getElementById("name").textContent = user.name.first + " " + user.name.last;
document.getElementById("email").textContent = user.email;
document.getElementById("phone").textContent = user.phone;
document.getElementById("location").textContent = user.location.city + ", " + user.location.country;
}
});
π οΈ Technologies Used
HTML
CSS
JavaScript
Fetch API
RandomUser.me API