Udemy_Go入門(1):Webインターフェースの作成
UdemyのGo講座。 今日はWebインターフェース。
- やりたいこと
- apiから値を取得して、値を3秒おきに表示していく
- handlerでchart.htmlを出力して
- chart.htmlがcandleapiから3秒おきに値を取得し
- 結果を出力する という流れ
- 方法
- サンプル
〜 <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script type="text/javascript"> function send () { var params = { "key1": "value1", "key2": "value2" } $.get("/api/", params).done(function (data) { console.log(data) var slices = data["slices"] $('#dashboard_div').append(slices[0].open + "<br>") }) } setInterval(send, 1000 * 3) window.onload = function () { send() } </script> 〜