1

I get the following error when loading googlechart using Ajax - when i run it normally its ok - here's the full error:

ReferenceError: google is not defined   
google.load("visualization3", "1", ({packages:["corechart"]}));

This is how i'm loading the file:

<script type="text/javascript">
    $('#sim_search').html('<div style="width:100%; margin-top:50px; text-align:center;">Finding your data now...<br /><br /><img src="/images_/icons/ajax-loader.gif" /></div>');
    $('#sim_search').load('/pages/includes/stats.php', {});
</script>

And the top of the file being loaded:

<!DOCTYPE html>
<html lang="en" class="en">
<head>
<link href="/css/style.css" rel="stylesheet" type="text/css" />

<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
  google.load('visualization', '1', {packages: ['corechart']});
  google.load('visualization3', '1', {packages: ['corechart']});
</script>

</head>
<body>

If I simply include the file as opposed to ajax it's ok but I need the loader image as it can take a while.

Any ideas? I've tried http as opposed to https for loading the Google API but still same error.

StudioTime
  • 22,603
  • 38
  • 120
  • 207
  • Upvote from me to compensate :) – Gabriel May 28 '14 at 15:37
  • Possible duplicate of [Google Maps API throws "Uncaught ReferenceError: google is not defined" only when using AJAX](https://stackoverflow.com/questions/14229695/google-maps-api-throws-uncaught-referenceerror-google-is-not-defined-only-whe) – Unni K S Oct 16 '18 at 15:25

0 Answers0