我给 2 个地点打电话。我从 xml 文件中获取某个位置的经度和经度。首先是最近的咖啡馆,然后是最近的学校。
$.get('https://maps.googleapis.com/maps/api/place/nearbysearch/xml?
location='+home_latitude+','+home_longtitude+'&rankby=distance&types=cafe&sensor=false&key=X',function(xml)
{
verander($(xml).find("result:first").find("geometry:first").find("location:first").find("lat").text(),$(xml).find("result:first").find("geometry:first").find("location:first").find("lng").text());
}
);
$.get('https://maps.googleapis.com/maps/api/place/nearbysearch/xml?
location='+home_latitude+','+home_longtitude+'&rankby=distance&types=school&sensor=false&key=X',function(xml)
{
verander($(xml).find("result:first").find("geometry:first").find("location:first").find("lat").text(),$(xml).find("result:first").find("geometry:first").find("location:first").find("lng").text());
}
);
Run Code Online (Sandbox Code Playgroud)
但正如您所看到的,我执行了函数 verander(latitude,longitude) 两次。
function verander(google_lat, google_lng)
{
var bryantPark = new google.maps.LatLng(google_lat, google_lng);
var panoramaOptions =
{
position:bryantPark,
pov:
{
heading: 185,
pitch:0,
zoom:1,
},
panControl : false,
streetViewControl : false,
mapTypeControl: false,
overviewMapControl: false ,
linksControl: false,
addressControl:false,
zoomControl : false,
}
map = new google.maps.StreetViewPanorama(document.getElementById("map_canvas"), panoramaOptions);
map.setVisible(true);
}
Run Code Online (Sandbox Code Playgroud)
是否可以仅在一个请求中推送这两个位置(也许通过数组)?我知道这听起来很愚蠢,但我真的想知道它们是否不是减少这些谷歌地图请求的后门。
FTR:这是对 Google 的请求:
A。当网页或应用程序加载时,使用 Maps JavaScript API(V2 或 …
我想触发fb:login-button:
<fb:login-button show-faces="true" width="200" max-rows="1"></fb:login-button>
Run Code Online (Sandbox Code Playgroud)
带有第二个按钮。为什么?我无法调整 Facebook 的 css,我想要一个带有自定义图像的精美按钮来替换它。我的大问题是我不知道 FB 按钮的 ID 是什么,而且我不能给它一个。
我的错误代码:
<script>
function Ffirst()
{
alert("first");
$("fb:login-button").click();
//$("fb:login-button").trigger("click"); //doesn't work eiter
}
</script>
<input type="submit" onclick="Ffirst()" name="savebutton" id="first" />
<fb:login-button show-faces="true" width="200" max-rows="1"></fb:login-button>
Run Code Online (Sandbox Code Playgroud)
FTR:
这就是我按下时发生的情况the fb:login-button
FB.Event.subscribe('auth.authResponseChange', function(response) {
// Here we specify what we do with the response anytime this event occurs.
if (response.status === 'connected') {
testAPI();
}
} else if (response.status === 'not_authorized') {
FB.login();
} else {
FB.login();
}
}); …Run Code Online (Sandbox Code Playgroud)