Updating DB with Chart JS


I am trying to add a function to the onClick listener on Chart JS labels. The function exists as soon as it hits the call to the DB. I get nothing back and the rest of the code does not execute. So the click executes on the front end calls to a function in a js file that should then talk to the DB. This is my code to incorporate the function to the chart js onClick.

            onClick: function(e, legendItem) {
                    if(err)     console.error(err);
                                var index = legendItem.index;
                                var ci = this.chart;
                                ci.data.datasets[0].data[index] +=1;

Is it not possible to access the DB from the db without post calls?

What’s the error that you are getting? Have you checked the logs in the console? This click function that you execute should be making a request to your server, which can then interact with your DB. You connect to the DB through the server so it should be accessed from there.