MCPcopy Create free account
hub / github.com/codemistic/Web-Development / getdata

Function getdata

Search Word Definitions/app.js:13–32  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

11deleteBtn.addEventListener('click',deletedata);
12
13function getdata(){
14
15 const xhr = new XMLHttpRequest();
16
17 xhr.open('GET',`https://mashape-community-urban-dictionary.p.rapidapi.com/define?term=${inputtext.value}`,true);
18 xhr.setRequestHeader("x-rapidapi-key", "3713d5b39dmshf1764344d8244d5p116e9ajsneb81024be405");
19 xhr.setRequestHeader("x-rapidapi-host", "mashape-community-urban-dictionary.p.rapidapi.com");
20
21 xhr.onload = function(){
22 const response = xhr.responseText;
23 const obj = JSON.parse(response);
24 // console.log(obj.list[0]);
25 str = str + `<strong>${inputtext.value} </strong><li> ${obj.list[0].definition}</li> <br>`;
26 show.innerHTML = str;
27 // inputtext.value = "";
28 }
29
30
31 xhr.send();
32}
33
34function deletedata(){
35show.innerHTML = "";

Callers

nothing calls this directly

Calls 1

parseMethod · 0.80

Tested by

no test coverage detected