2014-10-01 27 views
1

是否可以使用gmap3在由aAJ加載的div中顯示Google地圖?由ajax加載的div中的Google地圖

我試圖把腳本加載的頁面,但我取得了不sucess ..

我使用這個腳本

加載頁面
$(document).on('click','.letra',function(){ 
      var y = $(this).attr("data-letra"); 
     $.ajax({ 
      type: 'post', 
      url: 'pesquisa-cidade.php', 
      data: {'letra' : y}, 
      success: function(retorno){ 
       $("#aqui").html(retorno); 


      } 
     }) 
    }); 

誰能幫助我?

回答

0

是的,這是可能的。

第一種選擇:在您的retorno將HTML和JS代碼一起...

第二個選項:只放HTML你retorno但加入將結合GMAP到您的div HTML通話功能之後。例如:這裏

success: function(retorno){ 
    $("#aqui").html(retorno); 
    $('#map').gmap3(); 
} 

注意,您的ID必須爲map元素在你的retorno如果你想GMAP添加到它,你必須調用這個函數之前導入GMAP