简体   繁体   English

我如何使用jQuery请求加载谷歌地图

[英]How I can load google map with jquery request

I am trying to load google map with customized markers with jquery $post() request, the page is working fine but it is not working with $post , here is the sample code which I am trying to load https://developers.google.com/maps/documentation/javascript/examples/icon-complex and this is how I am calling it 我正在尝试使用jquery $post()请求来加载带有自定义标记的google map,该页面可以正常工作,但不能与$post一起使用,这是我尝试加载https://developers.google的示例代码.com / maps / documentation / javascript / examples / icon-complex ,这就是我所说的

$( document ).ready(function() {
     $.post('map.php',{state:3,id:1},function(data){
         $("#map").html(data);
    });

In this way you are setting the content of the map id with the result ( data ) of the $.post(..) not with the map. 这样,您将使用$.post(..)的结果( data )而不是地图来设置地图ID的内容。 I think you need to rewrite the function with a proper generation of the map or an invocation of an equivalent function. 我认为您需要使用适当的映射生成或调用等效函数来重写函数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM