-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbadges.html
More file actions
30 lines (29 loc) · 1.15 KB
/
Copy pathbadges.html
File metadata and controls
30 lines (29 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Badge Counter</title>
</head>
<body>
<h1>Badge Counter</h1>
<label for="userId">Enter your Roblox user ID:</label>
<input type="text" id="userId" name="userId">
<button onclick="fetchBadges()">Check Badges</button>
<p id="badgeCount"></p>
<script>
async function fetchBadges() {
const userId = document.getElementById('userId').value;
try {
const response = await fetch(`https://www.roblox.com/users/inventory/list-json?assetTypeId=21&cursor=&itemsPerPage=100&userId=${userId}`);
const data = await response.json();
const badgeCount = data.data.length;
document.getElementById('badgeCount').textContent = `You have ${badgeCount} badges.`;
} catch (error) {
console.error('Error fetching badges:', error);
document.getElementById('badgeCount').textContent = 'An error occurred. Please try again later.';
}
}
</script>
</body>
</html>