Newer
Older
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css"
integrity="sha384-xOolHFLEh07PJGoPkLv1IbcEPTNtaed2xpHsD9ESMhqIYd0nLMwNLD69Npy4HI+N" crossorigin="anonymous">
<title>Title</title>
<link rel="icon" type="image/x-icon" href="/pokemon/favicon.ico">
</head>
<body>
<script src="js/trainers.js"></script>
<script>
tableParentId = "tableDiv";
detailsParentId = "detailsDiv";
fetch('/pokemon/api/trainers')
.then(res => res.json())
.then(data => {
trainers = data;
createTrainersTable();
})
.catch(err => {
console.error(`Unable to fetch Pokemon Types: ${err.status}`);
console.error(err);
});
</script>
<h1>Trainers</h1>
<div class="container">
<div class="row">
<div id="tableDiv" class="col-8">No data</div>
<div id="detailsDiv" class="col-4">No data</div>
</div>
</div>
<form id="createTrainerForm" onsubmit = "createTrainer();">
<div class = "form-group">
<label for = "trainerName">Name</label>
<input type = "text" class = "form-control" id = "trainerName" required>
</div>
<div class = "form-group">
<label for = "profileUrl">Profile Url</label>
<input type = "text" class = "form-control" id = "profileUrl" required>
</div>
<button type = "submit" class = "btn btn-primary">Create Trainer</button>
</form>