第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Golang Highcharts 動態(tài)數(shù)據(jù)

Golang Highcharts 動態(tài)數(shù)據(jù)

Go
白衣非少年 2021-11-22 14:47:38
我目前正在學(xué)習(xí) golang 和一些 webstuff。所以請原諒我可能不太聰明的問題我的問題是我想提供一個帶有動態(tài)數(shù)據(jù)的 Highchart。我查找了文檔和示例,但無法使其正常工作。Highchart 示例:        <script type="text/javascript" src="http://code.jquery.com/jquery-1.10.1.js"></script>    <script type="text/javascript" src="http://code.highcharts.com/highcharts.js"></script>    <!-- 2. Add the JavaScript to initialize the chart on document ready -->    <script>    var chart; // global    /**     * Request data from the server, add it to the graph and set a timeout to request again     */    function requestData() {        $.ajax({            url: 'http://localhost:3000/',            success: function(point) {                var series = chart.series[0],                    shift = series.data.length > 20; // shift if the series is longer than 20                // add the point                chart.series[0].addPoint(eval(point), true, shift);                // call it again after one second                setTimeout(requestData, 1000);            },            cache: false        });    }    $(document).ready(function() {        chart = new Highcharts.Chart({            chart: {                renderTo: 'container',                defaultSeriesType: 'spline',                events: {                    load: requestData                }            },            title: {                text: 'Live random data'            },            xAxis: {                type: 'datetime',                tickPixelInterval: 150,                maxZoom: 20 * 1000            },            yAxis: {                minPadding: 0.2,                maxPadding: 0.2,                title: {                    text: 'Value',                    margin: 80                }            },            series: [{                name: 'Random data',                data: [1]            }]        });    });    </script>我的服務(wù)器應(yīng)按要求提供 json 編碼字符串。我可以看到 highchart 提出了一個請求。我猜 ajax 調(diào)用不理解我的 json?提前感謝您的任何幫助:)編輯:我是否也必須發(fā)送成功消息作為回報?
查看完整描述

1 回答

?
一只名叫tom的貓

TA貢獻(xiàn)1906條經(jīng)驗 獲得超3個贊

錯誤(感謝@jmaloney 的提示)


{"readyState":4,"status":200,"statusText":"success"}

ajax.html:28 parsererror: Error: jQuery110109016359453089535_1446814074235 was not called

一個簡單的


w.Header().Set("Access-Control-Allow-Origin", "*")

在我的去服務(wù)器上解決它:)


查看完整回答
反對 回復(fù) 2021-11-22
  • 1 回答
  • 0 關(guān)注
  • 178 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號