-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsat.js
More file actions
27 lines (24 loc) · 780 Bytes
/
Copy pathsat.js
File metadata and controls
27 lines (24 loc) · 780 Bytes
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
var url = "https://api.nasa.gov/planetary/earth/imagery?lon=100.75&lat=1.5&date=2014-02-01&cloud_score=True&api_key=DEMO_KEY";
$.ajax({
url: url,
success: function(result){
if("copyright" in result) {
$("#copyright").text("Image Credits: " + result.copyright);
}
else {
$("#copyright").text("Image Credits: " + "Public Domain");
}
if(result.media_type == "video") {
$("#apod_img_id").css("display", "none");
$("#apod_vid_id").attr("src", result.url);
}
else {
$("#apod_vid_id").css("display", "none");
$("#apod_img_id").attr("src", result.url);
}
$("#reqObject").text(url);
$("#returnObject").text(JSON.stringify(result, null, 4));
$("#apod_explaination").text(result.explanation);
$("#apod_title").text(result.title);
}
});