在php中我想在地图中显示多个位置。使用jquery.auto-geocoder.js为我的单个地址工作正常。但是要在我的地图中显示多个位置地址。
你有什么想法?????
<section>
<article>
<form>
<div class="full">
<input type="hidden" id="location" value="<?php echo $address?>">
</div>
</form>
</article>
</section>
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=Keyvalue&libraries=places"></script>
<script type='text/javascript' src='<?php echo JS_DIR; ?>jquery.auto-geocoder.js'></script>
<script>
$(function() {
$('#location').autoGeocoder();
});
</script>
这是针对单个地址的。寻找多个地址而不是纬度和经度
答案 0 :(得分:0)
将id
更改为class
并使用班级选择器:
<section>
<article>
<form>
<div class="full">
<input type="hidden" class="location" value="<?php echo $address1;?>">
<input type="hidden" class="location" value="<?php echo $address2;?>">
<input type="hidden" class="location" value="<?php echo $address3;?>">
</div>
</form>
</article>
</section>
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=Keyvalue&libraries=places"></script>
<script type='text/javascript' src='<?php echo JS_DIR; ?>jquery.auto-geocoder.js'></script>
<script>
$(function() {
$('.location').autoGeocoder();
});
</script>