Permalink
Fetching contributors…
Cannot retrieve contributors at this time
35 lines (31 sloc) 1.56 KB
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Sample illustrating the use of tagtog API and JavaScript</title>
</head>
<body>
<p>This sample shows how to annotate text using tagtog, the API and JavaScript. You can serve this page from your local server.</p>
<p><button>Annotate plain text and check the result in console</button></p>
<script>
function annotateText() {
fetch('https://www.tagtog.net/-api/documents/v1?project=yourProject&owner=yourUsername&output=ann.json', {
method: 'POST',
headers: {'Authorization' : "Basic " + btoa('yourUsername' + ":" + 'yourPassword'),
'Accept': 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({'text':'Antibody-dependent cellular cytotoxicity (ADCC), a key effector function for the clinical effectiveness of monoclonal antibodies, is triggered by the engagement of the antibody Fc domain with the Fcγ receptors expressed by innate immune cells such as natural killer (NK) cells and macrophages.'})
}).then(response => response.json()).then(json => {
console.log(json);
}).catch(function(error) {
console.log('Error: ', error);
});
}
var submitBtn = document.querySelector('button');
submitBtn.addEventListener('click', annotateText);
</script>
</body>
</html>