JSFiddle - React, Tailwind, and code Playground
by Shirly Manor
HTML
<button class="generate" onclick="callLambda();">Call Lambda</button>
<script>
async function callLambda() {
alert("test")
const response = await fetch("https://4k4smz181f.execute-api.us-east-1.amazonaws.com/Prod/what_is_cloudinary_autotag");
const movies = await response.json();
// alert(movies.tags);
console.log(movies)
console.log(movies.tags)
}
function checkLambda() {
var checkUrl = "https://4k4smz181f.execute-api.us-east-1.amazonaws.com/Prod/what_is_cloudinary_autotag"
httpLambda.open('GET', checkUrl);
httpLambda.send();
}
function constructAIHTTPRequests() {
constructLambdaHTTPRequests();
constructTranscriptHTTPRequests();
}
function constructLambdaHTTPRequests() {
httpLambda = new XMLHttpRequest();
httpLambda.onreadystatechange = function() {
if (this.readyState == 4) {
if(this.status == 200) {
var notify = JSON.parse(httpLambda.responseText);
checkLambdaNotification(notify);
}
setTimeout(getData,4000);
}
}
}
function constructTranscriptHTTPRequests() {
httpTranscript = new XMLHttpRequest();
httpTranscript.onreadystatechange = function() {
if (this.readyState == 4) {
if(this.status == 200) {
var notify = JSON.parse(httpTranscript.responseText);
checkTranscriptFile(notify);
}
setTimeout(getData,3000);
}
}
}
// constructAIPlayers();
constructAIHTTPRequests();
</script>