我有main.html中網頁,我打電話子頁面在main.html中是這樣的:谷歌地圖頁面沒有顯示阿賈克斯加載的內容
main.html中
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
</head>
<body>
<script type="text/javascript">
function getmyurl(url){
$('#mypageload').load(url);
}
</script>
<a href="javascript:void(0);" onclick="getmyurl('googlemap.htm');">google map</a>
<div id="mypageload">html page content will come to here like php include</div>
</body>
</html>
這是工作好對於普通頁面。但谷歌地圖(googlemap.htm)沒有顯示地圖。我猜這裏的問題:
google.maps.event.addDomListener(window, 'load', initialize);
我該如何解決修復問題?
googlemap.htm
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&libraries=places"></script>
</head>
<body>
<script>
function initialize() {
....
}
</script>
<div id="map-canvas"></div>
</body>
</html>
注:我的英語不是很好,我爲miskates遺憾。
謝謝您的回答和有用的例子。我現在解決了我的問題。 – webmaster
您的建議對我無效,但在任何情況下,您的示例代碼中都有拼寫錯誤。回調應該是第二個參數,而不是查詢字符串的一部分。 – Vincent