WordPress.org

Ready to get started?Download WordPress

Forums

morris.js or: how to load multiple javascripts (1 post)

  1. Metzgerr
    Member
    Posted 2 years ago #

    I want to insert morris.js (see http://oesmith.github.com/morris.js/) into my website. The needed JS files have been included into my functions.php which now looks like follows:

    // Enqueue the global JS - Ajax will not work without it
    wp_enqueue_script( 'dtheme-ajax-js', get_template_directory_uri() . '/_inc/global.js', array( 'jquery' ), $version );
    wp_enqueue_script( 'megamenu-js', get_template_directory_uri() . '/_inc/megamenu.js', array( 'jquery' ), $version );
    // morris.js Chart scripts
    wp_enqueue_script( 'raphael-js', 'https://raw.github.com/DmitryBaranovskiy/raphael/300aa589f5a0ba7fce667cd62c7cdda0bd5ad904/raphael-min.js', array( 'jquery' ) );
    wp_enqueue_script( 'morris-js', get_template_directory_uri() . '/_inc/morris/morris.js', array( 'jquery' ) );
    wp_enqueue_script( 'example-js', get_template_directory_uri() . '/_inc/morris/example.js', array( 'jquery' ) );
    wp_enqueue_script( 'prettify-js', get_template_directory_uri() . '/_inc/morris/prettify.js', array( 'jquery' ) );

    By loading the site I see the files been loaded probably. Sourcecode:

    <script type='text/javascript' src='http://x.com/wp-content/plugins/buddypress/bp-themes/v1/_inc/global.js?ver=20120110'></script>
    <script type='text/javascript' src='http://x.com/wp-content/plugins/buddypress/bp-themes/v1/_inc/megamenu.js?ver=20120110'></script>
    <script type='text/javascript' src='https://raw.github.com/DmitryBaranovskiy/raphael/300aa589f5a0ba7fce667cd62c7cdda0bd5ad904/raphael-min.js?ver=20120110'></script>
    <script type='text/javascript' src='http://x.com/wp-content/plugins/buddypress/bp-themes/v1/_inc/morris/morris.js?ver=20120110'></script>
    <script type='text/javascript' src='http://x.com/wp-content/plugins/buddypress/bp-themes/v1/_inc/morris/example.js?ver=20120110'></script>
    <script type='text/javascript' src='http://x.com/wp-content/plugins/buddypress/bp-themes/v1/_inc/morris/prettify.js?ver=20120110'></script>
    <script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js?ver=1.8.16'></script>

    However I can't display the morris.js chart on my website.
    What am I doing wrong?

Topic Closed

This topic has been closed to new replies.

About this Topic