我想从数据库中获取值。我将如何做到这一点?请帮忙
addMarkerToGroup(group, {lat:33.6844, lng:73.0479},
'<div>PH: 7.5 ' +
'</div><div>Temp: 24 <br>Conduct: 600</div>');
现在它是硬编码的,但我需要这些值(lat,long,ph,temp,conduct)来自mysql数据库。。数据库已经创建,只需要在Map上获取和设置标记。
function addMarkerToGroup(group, coordinate, html) {
var marker = new H.map.Marker(coordinate);
// add custom data to the marker
marker.setData(html);
group.addObject(marker);
}
function addInfoBubble(map) {
var group = new H.map.Group();
map.addObject(group);
// add 'tap' event listener, that opens info bubble, to the group
group.addEventListener('tap', function (evt) {
// event target is the marker itself, group is a parent event target
// for all objects that it contains
var bubble = new H.ui.InfoBubble(evt.target.getPosition(), {
// read custom data
content: evt.target.getData()
});
// show info bubble
ui.addBubble(bubble);
}, false);
addMarkerToGroup(group, {lat:33.6844, lng:73.0479},
'<div>PH: 7.5 ' +
'</div><div>Temperture: 24 <br>Conductivity: 600</div>');
}
1条答案
按热度按时间imzjd6km1#
我假设您将使用php作为您的服务器端脚本,您可以转到这里:php connect to mysql了解如何连接您的mysql服务器,然后您可以使用以下方法获取数据:php select data from mysql