0

In hook_preprocess_page(), I added a custom JavaScript file used for adding a chart to the page.

    drupal_add_js(drupal_get_path('theme', '****') .'/js/loader.js', array('type' => 'file', 'scope' => 'header'));
    drupal_add_js(drupal_get_path('theme', '****') .'/js/compare-fund.js', array('type' => 'file', 'scope' => 'footer', 'weight' => 1)); 

Loader.js execute first and compare_fund.js is called last., but this loader.js file calls https://www.gstatic.com/charts/46.2/loader.js which get loaded after my custom JavaScript file and causes these errors.

compare-fund.js?pog52v:169 Uncaught TypeError: Cannot read property 'arrayToDataTable' of undefined
compare-fund.js?pog52v:278 Uncaught TypeError: Cannot read property 'DataTable' of undefined

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.