-
Notifications
You must be signed in to change notification settings - Fork 0
/
buscaGif.js
43 lines (31 loc) · 1014 Bytes
/
buscaGif.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
33
34
35
36
37
38
39
40
41
42
43
var campo = '';
var campo2 = '';
function busca(){
campo2 = document.getElementById('campobusca').value;
campo2.innerHTML = campo2;
}
function verifi(){
$.ajax({
// url:'https://api.b7web.com.br/cinema/',
url:'https://api.tenor.com/v1/search?q='+campo2,
type:'GET',
dataType:'json',
beforeSend:function(){
$('.filmes').html('<div class="col-md-12"> Carregando ...</div>')
},
success:function(data){
console.log(data);
var html = '';
for(var i in data.results){
html += '<div class="col-md-4 "><div class="filme"><img src="'+data.results[i].media[0].gif.url+'" /></div></div>'
}
$('.filmes').html(html);
}
})
}
$(function(){
$('#campobusca').keyup(function () {
setTimeout(verifi, 1000);
busca();
});
});