It seemed like you were on the right track with the jquery stuff, but it's a bit hard for me to debug it. My guess is that you should be using a newer version of jQuery. My suggestion would be to use the newest version of jQuery. You can use the google hosted version for that: <script src="// ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
You also shouldn't need the migrate script. I'm not sure why you have that. On Tue Oct 28 2014 at 3:27:16 PM Manuel <[email protected]> wrote: > Hey Sergey, > > thank you very much for your answer. > Everything works with your code. My problem now is that I don't know how I > get the data out of my php-file in a way that it will be displayed. > I mean sth. like this: > > var data = new google.visualization.DataTable( GET ME THE DATA OUT OF GEO. > php); > > I don't get the link between them. > > Thank you again for your help. > > Best > Manuel > > Am Dienstag, 28. Oktober 2014 19:24:39 UTC+1 schrieb Sergey: >> >> Hi Manuel, >> >> I wasn't able to reproduce your issue, but here is a jsfiddle that has >> the code you wrote: http://jsfiddle.net/o4banc3z/ >> >> I hope that helps. >> >> On Tue Oct 28 2014 at 1:36:07 PM Manuel <[email protected]> wrote: >> > Hi, >>> >>> I just started with the google visualization API (actually with the >>> whole html/php etc. thing :-) ). >>> So what I've got right now is the following PHP: >>> >>> <!-- Datei zum bereitstellen von Daten für GEO-CHART --> >>> >>> <?php >>> $MYSQL_HOST="localhost"; >>> $MYSQL_BENUTZER="root"; >>> $MYSQL_KENNWORT="" ; >>> $MYSQL_DATENBANK="db_index"; >>> >>> >>> $db = mysql_connect($MYSQL_HOST, $MYSQL_BENUTZER, $MYSQL_KENNWORT)or >>> die (mysql_error ()); >>> mysql_select_db($MYSQL_DATENBANK) or die(mysql_error()); >>> >>> $year = '2014'; >>> >>> $SQLString = "SELECT >>> tb_countries.label,datenpool.id,datenpool.jahr,datenpool.dblindex >>> FROM ( SELECT ID,Jahr,dblIndex FROM >>> tb_ind_fra >>> UNION >>> SELECT ID,Jahr,dblIndex FROM tb_ind_ger >>> ) datenpool >>> INNER JOIN tb_countries >>> ON tb_countries.ID = datenpool.ID >>> WHERE datenpool.jahr = '$year'"; >>> >>> $result = mysql_query($SQLString); >>> # build Google API JSON for GEO CHART >>> # Columns >>> echo "{ \"cols\": [ >>> {\"id\":\"\",\"label\":\"Country\",\"type\":\"string\"}, >>> {\"id\":\"\",\"label\":\"Index\",\"type\":\"number\"} ], \"rows\": [ "; >>> # Rows >>> $total_rows = mysql_num_rows($result); >>> $row_num = 0; >>> while($row = mysql_fetch_array($result)){ >>> $row_num++; >>> if ($row_num == $total_rows){ >>> echo "{\"c\":[{\"v\":\"" . $row['label'] . "\",\"f\":null},{\"v\":" . >>> $row['dblindex'] . ",\"f\":null}]}"; >>> } else { >>> echo "{\"c\":[{\"v\":\"" . $row['label'] . "\",\"f\":null},{\"v\":" . >>> $row['dblindex'] . ",\"f\":null}]}, "; >>> } >>> } >>> echo " ] }"; >>> >>> mysql_close($db); >>> ?> >>> >>> >>> When I call this file I get: >>> { "cols": [ {"id":"","label":"Country","type":"string"}, {"id":"", >>> "label":"Index","type":"number"} ], "rows": [ {"c":[{"v":"Germany","f": >>> null},{"v":300,"f":null}]}, {"c":[{"v":"France","f":null},{"v":150,"f": >>> null}]} ] } >>> >>> And then I try to create the geochart with this: >>> <html> >>> <head> >>> <!--Load the AJAX API--> >>> <script type="text/javascript" src="http://www.google.com/jsapi >>> "></script> >>> <script src="//code.jquery.com/jquery-1.11.0.min.js"></script> >>> <script src="//code.jquery.com/jquery-migrate-1.2.1.min.js"></script> >>> <script type="text/javascript"> >>> google.load("visualization", "1", {packages:["geochart"]}); >>> google.setOnLoadCallback(drawRegionsMap); >>> >>> function drawRegionsMap() { >>> >>> var jsonData = $.ajax({ >>> url: "geo.php", >>> dataType:"json", >>> async: false >>> }).responseText; >>> >>> // Create our data table out of JSON data loaded from server. >>> var data = new google.visualization.DataTable(jsonData); >>> >>> >>> var options = {}; >>> >>> var chart = new google.visualization.GeoChart( >>> document.getElementById('regions_div')); >>> >>> chart.draw(data, options); >>> } >>> </script> >>> </head> >>> <body> >>> <div id="regions_div" style="width: 900px; height: 500px;"></div> >>> </body> >>> </html> >>> >>> But ist just doesn't work. I tried several other codes but it just >>> displays nothing. >>> What I get is an error message: Uncaught TypeError: undefined is not a >>> function >>> here: >>> var jsonData = $.ajax({ >>> >>> What is wrong with my code? >>> >>> I'm looking forward to every feedback I get. >>> >>> Thank you in advance >>> >>> Best, >>> Manuel >>> >>> >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Google Visualization API" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> >> To post to this group, send email to [email protected]. >> >> >>> Visit this group at http://groups.google.com/ >>> group/google-visualization-api. >>> For more options, visit https://groups.google.com/d/optout. >>> >> -- > You received this message because you are subscribed to the Google Groups > "Google Visualization API" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to > [email protected]. > Visit this group at > http://groups.google.com/group/google-visualization-api. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Google Visualization API" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/google-visualization-api. For more options, visit https://groups.google.com/d/optout.
