admin管理员组文章数量:1336331
Trying to add google autoplete in Laravel. My code is like follows-
<script type="text/javascript" src=";libraries=places"></script>
<script type="text/javascript">
google.maps.event.addDomListener(window, 'load', function () {
var places = new google.maps.places.Autoplete(document.getElementById('txtPlaces'));
google.maps.event.addListener(places, 'place_changed', function () {
});
});
</script>
<span>Location:</span>
<input type="text" id="txtPlaces" style="width: 250px" placeholder="Enter a location" />
Its absolutely works in HTML / PHP file. The output in html/php file is like that-
However, when I wanna implement in Laravel, its not working at all. It shows the following error.
Can you help me to fixed this one?
Trying to add google autoplete in Laravel. My code is like follows-
<script type="text/javascript" src="http://maps.googleapis./maps/api/js?sensor=false&libraries=places"></script>
<script type="text/javascript">
google.maps.event.addDomListener(window, 'load', function () {
var places = new google.maps.places.Autoplete(document.getElementById('txtPlaces'));
google.maps.event.addListener(places, 'place_changed', function () {
});
});
</script>
<span>Location:</span>
<input type="text" id="txtPlaces" style="width: 250px" placeholder="Enter a location" />
Its absolutely works in HTML / PHP file. The output in html/php file is like that-
However, when I wanna implement in Laravel, its not working at all. It shows the following error.
Can you help me to fixed this one?
Share Improve this question edited Jul 19, 2016 at 9:22 tisuchi asked Jul 12, 2016 at 6:45 tisuchitisuchi 9641 gold badge15 silver badges19 bronze badges 4- which google api script file you included? – Dhara Parmar Commented Jul 12, 2016 at 6:49
- @DharaParmar, its update now... <script type="text/javascript" src="maps.googleapis./maps/api/…> – tisuchi Commented Jul 12, 2016 at 6:53
- where you inject your API key? – Hamed Nemati Commented Jul 12, 2016 at 6:59
- In raw html/php file, it works fine without API key.. – tisuchi Commented Jul 12, 2016 at 7:00
1 Answer
Reset to default 5You need to add key in url, the reason of this error is that you haven't configured your Google Maps API keys yet.
Refer to see - How to create key: http://docs.gravityview.co/article/306-signing-up-for-a-google-maps-api-key
Add key to url:
<script src="https://maps.googleapis./maps/api/js?key=YOUR API KEY&libraries=places"></script>
or use this url:
<script type="text/javascript" src="https://maps.googleapis./maps/api/js?v=3.exp&sensor=false&libraries=places"></script>
本文标签: javascriptGoogle Map Autocomplete with LaravelStack Overflow
版权声明:本文标题:javascript - Google Map Autocomplete with Laravel - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742239270a2438656.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论