forked from davsket/mejorando.la
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathartista.html
52 lines (48 loc) · 1.17 KB
/
artista.html
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Buscador de Artistas</title>
</head>
<body>
<h1>Buscador de Artistas</h1>
<label for="artist">Ingresa tu artista favorito</label>
<input type="text" id="artista">
<button id="buscar">buscar</button>
<div id="resultado"></div>
<script type="text" id="artist">
<article class="content">
<h2 id="nombre-artista"></h2>
<figure>
<img src="" alt="">
<figcaption></figcaption>
</figure>
<aside id="band-members"></aside>
<p id="bio-artista"></p>
</article>
</script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script>
var $artista = $('#artista'),
$buscar = $('#buscar')
$artista.on('keyup', function(evt){
if( evt.keyCode == '13' ){ // enter
buscarArtista()
}
})
$buscar.on('click', buscarArtista)
function buscarArtista(){
//Peticion AJAX
$.ajax({
data: {
artist: $artista.val(),
api_key: '42f75f939105d2110d6a0daf27db431c',
format: 'json',
method: 'artist.getinfo'
},
url: 'http://ws.audioscrobbler.com/2.0/'
})
}
</script>
</body>
</html>