のねのBlog

パソコンの問題や、ソフトウェアの開発で起きた問題など書いていきます。よろしくお願いします^^。

Uncaught ReferenceError: google is not defined

load.js

google.load("visualization", "1", {packages:["corechart"]});

スクリプトを読む順番がおかしかった。

修正前

 <head>
    <link rel="stylesheet" href="style.css" type="text/css"/>
	<script type="text/javascript" src="js/jquery.min.js"></script>
	<script type="text/javascript" src="js/common.js"></script>
	<script type="text/javascript" src="js/pop.js"></script>
	<script type="text/javascript" src="js/load.js"></script>
	<script type="text/javascript" src="js/onload.js"></script>
	<script type="text/javascript" src="https://www.google.com/jsapi"></script>
  </head>

修正後

 <head>
    <link rel="stylesheet" href="style.css" type="text/css"/>
	<script type="text/javascript" src="https://www.google.com/jsapi"></script>
	<script type="text/javascript" src="js/jquery.min.js"></script>
	<script type="text/javascript" src="js/common.js"></script>
	<script type="text/javascript" src="js/pop.js"></script>
	<script type="text/javascript" src="js/load.js"></script>
	<script type="text/javascript" src="js/onload.js"></script>
  </head>