简体   繁体   English

mysql数据库中的javascript变量

[英]javascript variable from mysql database

Hi I'm trying to plot multiple values and successfully done using this variable. 嗨,我正在尝试绘制多个值并成功使用此变量完成操作。

    var locations = [
  ['Bacolod City', 10.64073 ,122.9689, 4],
  ['Bago City', 10.5333 ,122.8333, 5],
  ['Cadiz City', 10.950, 123.29, 3],
  ['Sipalay City', 9.7519, 122.40, 2],
  ['Kabankalan City', 9.896, 122.831, 1]
];

Now my next step is instead of static data like above, I would like to retrieve data from my mysql database and use it for var locations . 现在,我的下一步是代替上面的静态数据,我想从mysql数据库中检索数据并将其用于var位置 Would appreciate any help on how to perform that. 将不胜感激如何执行该操作。 most i have seen is complicated and use json which i have no experience in. Thanks in advance. 我见过的大多数东西都很复杂,并且使用了我没有经验的json。在此先感谢。

Note:Btw I'm trying to plot using google maps api. 注意:顺便说一句,我正在尝试使用Google Maps API进行绘图。 sorry for not mentioning. 抱歉没有提及。

您应该阅读有关Ajax的信息,或者可以使用许多教程之一: http : //www.php4every1.com/tutorials/jquery-ajax-tutorial/

If you look at the Articles section of the documentation there are several examples of how to use PHP/MySQL with the Google Maps API v3: 如果您查看文档的“ 文章”部分,有几个示例如何将PHP / MySQL与Google Maps API v3结合使用:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM