Skip to content
Snippets Groups Projects
Commit 095e5981 authored by Ruginosu, M.I. (Ioana, Student B-BIT)'s avatar Ruginosu, M.I. (Ioana, Student B-BIT) :ear_tone1:
Browse files

issue 2

parent db82b591
No related branches found
No related tags found
No related merge requests found
......@@ -60,4 +60,20 @@ function createPokemonTypesTable() {
</tbody>
</table>
`
}
function createTrainer() {
const name = document.getElementById('trainerName').value;
const profileurl = document.getElementById('profileUrl').value;
const data = {
profileUrl: profileurl,
name: name
}
fetch('/pokemon/api/trainers', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(data)
}).then(response => updateTrainerTable())
}
\ No newline at end of file
......@@ -40,5 +40,17 @@
</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>
</body>
</html>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment