-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathx.js
29 lines (26 loc) · 870 Bytes
/
x.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
var url = "https://lessonfourapi.tanaypratap.repl.co/translate/yoda.json?text=I am Jaadu Jalwa";
fetch(url).
then(function responseHandler(response) {return response.json()}).
then (function sendJSON(json){console.log(json)})
.catch((error) => {
console.log(error)
});
const text1 = "Because, I am Batman";
getConstructor(text1);
const text2 = "My name is Heisenberg!";
getConstructor(text2);
const text3 = "I am Groot";
getConstructor(text3);
var changableURL = "XYZ";
function getConstructor(text) {
changableURL = "https://lessonfourapi.tanaypratap.repl.co/translate/yoda.json?text=" + text;
talkToServer(changableURL);
}
function talkToServer(url) {
fetch(url).
then(function responseHandler(response) {return response.json()}).
then (function sendJSON(json){console.log(json)})
.catch((error) => {
console.log(error)
});
}