2014-10-01 25 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