0

i am using javascript to add a series to a highchart. And i like to load the data to the series by an ajax call.

Here is my code:

function loadHighchartSeries(){
            for (var i = 0; i < checkedGrpAdr3.length; i++) {
                series_name = checkedGrpAdr3[i];
                found = false;
                for (var j = 0; j < chart.series.length; j++){
                    console.log(chart.series[j].name);
                    if (chart.series[j].name==series_name){
                        found = true;
                    }
                }
                if (!found){
                    datavar = ajax .... ????
                    chart.addSeries({
                        name: series_name,
                        data: datavar
                    });
                }
            }
        }

The checkedGrpAdr3 is an array that contains the names of the series. First i check if the series name exists in the highchart graph. If it not exists it should load the data by using an ajax call and add a new series to the chart.

But how can i load the data by ajax and put it into the variable "datavar"?

Thanks

Mike
  • 693
  • 1
  • 13
  • 31
  • 2
    possible duplicate of [jQuery: Performing synchronous AJAX requests](http://stackoverflow.com/questions/6685249/jquery-performing-synchronous-ajax-requests) – GramThanos Sep 08 '15 at 13:50
  • You can use a $.get() / $.getJSON() / $.ajax() and load data. All of them are documented in jquery docs. – Sebastian Bochan Sep 09 '15 at 09:25

0 Answers0