Accepted answer

$.getScript() is an asynchronous operation, meaning it will go fetch the script but won't wait for it to be done before processing the rest of the code. Therefore you need to wait for some sort of indication that the code has been retrieved. If you look at the docs you will notice that $.getScript() has a success callback function just for this purpose. In fact, you already have an empty success function in your code, just move the Highcharts declaration there. In other words, do this:

$(document).ready(function() {
    $.getScript('js/libs/highcharts.src.js', function() {
        chart1 = new Highcharts.Chart({
            // Highcharts options

Related Query

More Query from same tag