-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathorcidbio.js
51 lines (33 loc) · 1.15 KB
/
orcidbio.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
46
47
48
49
/**
* Created by marviro on 05/04/2017.
*/
function ORCIDbio(orcidID, mydiv) {
var ORCIDLink = "https://pub.orcid.org/v2.0/" + orcidID + "/biography";
fetch(ORCIDLink,
{
headers: {
"Accept": "application/orcid+json"
}
})
.then(
function (response) {
if (response.status !== 200) {
console.log('Looks like there was a problem. Status Code: ' +
response.status);
return;
}
// Examine the text in the response
response.json().then(function (data) {
////DEBUG!
console.log();
//bio
var bio = data.content;
document.getElementById(mydiv).innerHTML = bio;
document.writeln = bio;
});
}
)
.catch(function (err) {
console.log('Fetch Error :-S', err);
});
}