我有一個顯示數據庫中數據的頁面。我使用jQuery,PHP和mysqli來顯示數據。當您將鼠標懸停在每個記錄的某個鏈接上時,我想要一個工具提示,其中會顯示一個谷歌地圖,根據數據庫中該記錄的lat和lng顯示該記錄的位置。我正在使用jQuery UI工具提示。把谷歌地圖放到工具提示中
但是,如何將googlemap轉換爲工具提示?
<script type="text/javascript">
$(function() {
$(document).tooltip({
});
});
$(window).load(function() {
$.get('process.php', function(data){
$('.loading').hide();
$('#chart').html(data);
});
});
process.php:
<?php
include_once ('./myfile.php');
//open database
$db = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); //open db conn
if (mysqli_connect_errno()) {
printf("Connect failed: %s", mysqli_connect_error());
exit();
}
$infoboxText = "";
//get list of each muni with its lat and lng
$qGolf="SELECT * FROM golf";
$result_golf = $db->query($qGolf);
$infoboxText= "<table class='infoboxWindow'><tr><th>Course Name</th><th>Location</th><th>Phone</th><th>Holes</th><th>Daily Fee<br/>9 Holes</th><th>Daily Fee<br/>18 Holes</th><th>Weekend Fee<br/>9 Holes</th><th>Weekend Fee<br/>18 Holes</th><th>Cart Fee<br/>9 Holes</th><th>Cart Fee<br/>18 Holes</th><th>Tee Times</th></tr>";
while($golfList = $result_golf->fetch_array(MYSQLI_ASSOC)) {
//build the infobox text with a table to hold the data
$infoboxText.="<tr><td>" .$golfList["Course_Name"] . "</td>";
//$infoboxText.="<td><div title='This is a tooltip.' class='locate'>Show</div></td>";
$infoboxText.="<td><a href='#' title='This is a tooltip.' class='locate'>Show</a></td>";
$infoboxText.="<td>".$golfList["Phone"]."</td>";
$infoboxText.="<td>".$golfList["Holes"]."</td>";
$infoboxText.="<td>".$golfList["Daily_Fee_9_Holes"]."</td>";
$infoboxText.="<td>".$golfList["Daily_Fee_18_Holes"]."</td>";
$infoboxText.="<td>".$golfList["Weekend_Fee_9_Holes"]."</td>";
$infoboxText.="<td>".$golfList["Weekend_Fee_18_Holes"]."</td>";
$infoboxText.="<td>".$golfList["Cart_Fee_9_Holes"]."</td>";
$infoboxText.="<td>".$golfList["Cart_Fee_18_Holes"]."</td>";
$infoboxText.="<td>".$golfList["Tee_Times"]."</td></tr>";
//close the table
}
$infoboxText.="</table>";
echo $infoboxText; //return the circles code here
?>
HTML:
<div class="loading">LOADING ...</div>
<div id="chart"> </div>
該解決方案必須是跨瀏覽器,包括IE的東西。 – LauraNMS