我正在使用Google Maps API。如果頁面上有javascript錯誤,谷歌地圖不加載?
$map = $this->ci->gis->draw_map_position_by_lat_long($this->ci->profile_data['LocLat'],$this->ci->profile_data['LocLong']);
$this->ci->widgets['map']= $map;
功能:通過我得到了谷歌地圖
public function draw_map_position_by_lat_long($lat = NULL , $long = NULL) {
$load['center'] = $lat . ',' . $long;
$load['map_height'] = "191px";
$this->ci->googlemaps->initialize($load);
$i = 0;
$marker = array();
$marker['position'] = $lat . ',' . $long;
$marker['draggable'] = 'TRUE';
$marker['ondragend'] = "dragmarker(this.getPosition().lat(),this.getPosition().lng())";
$this->ci->googlemaps->add_marker($marker);
$map = $this->ci->googlemaps->create_map();
$this->position_data = array('map' => $map);
return $this->position_data;
}
地圖是在我的應用程序的每一個地方,而不只是一個地方的任何問題。
奇怪的是當我在服務器端打印地圖時沒有顯示。
$map = $this->ci->gis->draw_map_position_by_lat_long($this->ci->profile_data['LocLat'],$this->ci->profile_data['LocLong']);
$this->ci->widgets['map']= $map;
pre($map);
這樣的:
我在Firebug和no java-script errors
檢查。
我發現的另一個奇怪的事情是,當我刪除我的一個JavaScript文件時,地圖加載完美,但它與Google Map沒有直接聯繫。也沒有在Firebug中顯示的JavaScript錯誤。
該腳本是:
jQuery(document).ready(function(){
jQuery('#photo-slider').bxSlider();
window.onload = createUploader;
});
我不知道什麼是錯的,我在這裏停留。任何建議將不勝感激。謝謝
爲什麼所有的代碼上面用PHP寫的?您是否使用此http://code.google.com/p/php-google-map-api/?有一件與你的javascript不兼容的事情是,在jQuery(document).ready()中你不應該使用window.onload = createUploader。用createUploader()替換它; – wheresrhys 2012-02-01 12:13:06