-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain.js
32 lines (29 loc) · 869 Bytes
/
main.js
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
31
32
// Navbar active
$(document).ready(function() {
"use strict";
$('ul.nav__links > li').click(function(e) {
e.preventDefault();
$('ul.nav__links > li').removeClass('active');
$(this).addClass('active');
});
});
function putValue(input) {
var div = document.getElementById("input");
div.value = input;
}
function fetchAPI(input) {
fetch('https://api.pikaserve.xyz/' + input)
.then(response => response.json())
.then(data => {
var div = document.getElementById("pokeData");
$(div).empty();
poke = JSON.stringify(data, null, 4);
var div = document.getElementById("pokeData");
$(div).append(poke);
})
.catch(err => {
console.error(err)
});
var form = document.getElementById("poke-form");
form.reset();
}