我在此处指定了place id“placeid = results [0] .place_id”但它没有设置。它返回给我未定义。分配操作在那里失败。Javascript值不分配
function match_up_dn(address)
{
geocoder = new google.maps.Geocoder();
var placeid;
if (geocoder)
{
geocoder.geocode({
'address': address
}, function (results, status) {
if (status == google.maps.GeocoderStatus.OK) {
console.log("al:-"+results[0].place_id);
placeid = results[0].place_id;
}
else
{
alert("undefined address");
}
});
}
return placeid;
}
重写问题,以便它使一点点意义。 – jitendragarg
我在此处指定了place id“placeid = results [0] .place_id”,但它没有设置。它返回给我未定义。分配操作在那里失败。 –
我要求重写,而不是复制粘贴问题中提到的同一行。如果你无法忍受试图解释你的问题,不要指望任何人帮助你解决问题。 – jitendragarg