-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
46 lines (32 loc) · 1.36 KB
/
script.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
44
45
// buscar a imagem e o texo
let btn = $(".btn").click(()=>{
buscarData()
})
function buscarData() {
let dataDesejada = $(".dataDesejada").val()
$.ajax({
url: `https://api.nasa.gov/planetary/apod?api_key=5lVIJbkSYci40KMD082vyIGkrqTfrJCHGWptg70H&date=${dataDesejada}`,
type: `GET`,
success: function(response){
$("#img").html(`<img id="img" src="${response.hdurl}">`),
$("#explicacao").text(`${response.explanation}`)
},
error: function() {
if (dataDesejada < "1995-06-16") {
return alert("The first photo in the astronomy picture of the day was taken in 1995-06-16, please type a date above this day.")
} //adicionar erro a datas inferiores a "1995-06-16"
},
})
}
let btnPrincipal = $('#btnPrincipal').click(()=>{ //ao clicar na pagina inicial, é redirecionado pra apod
location.assign("apod.html")
})
let home = $('#home').click(()=>{ //ao clicar, é redirecionado pra pagina inicial
location.assign("index.html")
})
let linkedin = $('#linkedin').click(()=>{ //ao clicar, é redirecionado pro meu linkedin
location.assign("https://www.linkedin.com/in/j%C3%A9ssica-bispo-/")
})
let github = $('#github').click(()=>{ //ao clicar, é redirecionado pro meu github
location.assign("https://github.com/jessbispo")
})