mirror of
https://github.com/Starlio-app/Starlio-web.git
synced 2024-12-28 19:23:45 +03:00
17 lines
No EOL
786 B
JavaScript
17 lines
No EOL
786 B
JavaScript
$.ajax({
|
|
url: `https://api.nasa.gov/planetary/apod?api_key=1gI9G84ZafKDEnrbydviGknReOGiVK9jqrQBE3et&start_date=${new Date().toLocaleString().slice(6, 10)}-${new Date().toLocaleString().slice(3, 5)}-01&end_date=${new Date().toLocaleString().slice(6,10)}-${new Date().toLocaleString().slice(3, 5)}-${new Date().toLocaleString().slice(3, 5)}`,
|
|
type: "GET",
|
|
success: function(data){
|
|
for (let i = 0; i < data.length; i++) {
|
|
if (data[i].media_type == "image") {
|
|
$(".header-row").append(`
|
|
<span>
|
|
<div class="card">
|
|
<img src="${data[i].url}" alt="${data[i].title}" class="card-img-top">
|
|
</div>
|
|
</span>
|
|
`)
|
|
}
|
|
}
|
|
}
|
|
}); |