Search code examples
javascriptjquerymorris.js

Problems loading jquery, raphael and morris


I am trying to learn making graphs in html and I found a morris.js library that allows to do it. But I have a problem on the stage of trying to connect libraries. I copied the part from official website of morris, but it does not work. After entering the page I get very long loading (a few minutes). Has anyone encountered such problem? How to fix such long loading of the page?

<html>
    <head>
        <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/morris.js/0.5.1/morris.css">
        <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
        <script src="//cdnjs.cloudflare.com/ajax/libs/raphael/2.1.0/raphael-min.js"></script>
        <script src="//cdnjs.cloudflare.com/ajax/libs/morris.js/0.5.1/morris.min.js"></script> 
    </head>
    <body>
    </body>
</html>

Solution

  • To use the CDN-hosted assets add https: to source address

    <html>
        <head>
            <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/morris.js/0.5.1/morris.css">
            <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
            <script src="https://cdnjs.cloudflare.com/ajax/libs/raphael/2.1.0/raphael-min.js"></script>
            <script src="https://cdnjs.cloudflare.com/ajax/libs/morris.js/0.5.1/morris.min.js"></script> 
        </head>
        <body>
        </body>
    </html>
    

    or if you want to load script from local filesystem then just replace address with path to file.