close

Class SurroundingClass
    Private currency = "BTC"
    Private url = "https://api.coinbase.com/v2/exchange-rates?currency=" & currency
    Private usd = document.querySelector(".usd")
    Private twd = document.querySelector(".twd")

    Private Function makeRequest() As [function]
        xhr = New XMLHttpRequest()
        xhr.onload = [function]()

        If True Then
            Dim response = JSON.parse(Me.responseText)
            usd.innerHTML = response.data.rates.USD & " USD"
            twd.innerHTML = response.data.rates.TWD & " TWD"
        End If

        xhr.open("GET", url, True)
        xhr.setRequestHeader("CB-VERSION", "2018-01-01")
        xhr.send()
    End Function

    Private Sub New()
    End Sub
End Class

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 dwanue 的頭像
    dwanue

    dwanue IT Life

    dwanue 發表在 痞客邦 留言(0) 人氣()