1๐
I think you are mixing different contexts. The line that gives you an error is executed in the browser, and in that context, there is no variable named result
.
Since you have a endpoint /serverdata
on your server in place, all you need to load and parse the data from that URL. Details depend on what kinds of JavaScript libraries you are using, but with jQuery getJSON:
$.getJSON("/serverdata", function(data) {
/* Update your chart by using 'data' */
});
- Chartjs-Where do I use chartjs's destroy function?
- Chartjs-How do I get the current step size of a chartjs chart whose stepSize I have not defined?
Source:stackexchange.com