-
Notifications
You must be signed in to change notification settings - Fork 2
/
app1.js
41 lines (33 loc) · 1 KB
/
app1.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
30
31
32
33
34
35
36
37
38
39
40
41
// const axios = use('axios')
'use strict'
const binanceApiUrl = "https://api.binance.com";
let apiResponse;
const title = document.getElementById("title");
let cryptoTitle;
let query = '/api/v1/ticker/24hr';
query += '?symbol=ETHBTC';
const url = binanceApiUrl + query;
const getApiInfo = (async (request, response) => {
const cryptoData = await axios
.get(url)
.then((res) => {
if (res.status == 200)
console.log('cryptoData:', res.data)
return res.data
})
.catch((error) => {
console.log(error)
})
if (cryptoData == false)
return response.json([])
// return response.json(cryptoData)
})();
// const newRequest = new XMLHttpRequest();
// newRequest.open('GET', url, true);
// newRequest.onload = function () {
// console.log("array from string: ", newRequest.responseText.split(","));
// this.cryptoTitle = newRequest.responseText;
// console.log("cryptoTitle: ", cryptoTitle);
// document.getElementById("title").innerHTML += Array.from(this.cryptoTitle);
// }
// newRequest.send();