Difference between revisions of "Widget:APITest"

From Buddha-Nature
((by SublimeText.Mediawiker))
Tag: Blanking
((by SublimeText.Mediawiker))
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
 
+
<script type="text/javascript">
 +
var apiEndpoint = "https://commons.tsadra.org/api.php";
 +
var params = "action=ask&query=%5B%5BDorje,_G.%5D%5D%7C%3FBio&format=json";
 +
fetch(apiEndpoint + "?" + params + "&origin=*")
 +
.then(function(response){return response.json();})
 +
.then(function(response) {
 +
var results = response.query.results;
 +
Object.keys(results).forEach(function(key) {
 +
console.log(results[key].Bio);
 +
});
 +
});
 +
</script>

Latest revision as of 17:27, 16 December 2022

<script type="text/javascript"> var apiEndpoint = "https://commons.tsadra.org/api.php"; var params = "action=ask&query=%5B%5BDorje,_G.%5D%5D%7C%3FBio&format=json"; fetch(apiEndpoint + "?" + params + "&origin=*") .then(function(response){return response.json();}) .then(function(response) { var results = response.query.results; Object.keys(results).forEach(function(key) { console.log(results[key].Bio); }); }); </script>