I am using Google Maps API using Javascript, some how my app is throwing this error 'Uncaught Syntax error handle. Could i be missing some javascript libraries to this view, please advice me and help mates.
- @{
- ViewBag.Title = "GoogleMaps";
- Layout = null;
- }
-
- <!DOCYTPE html>
- <html>
- <head>
- <meta name="viewport" content="width=device-width"/>
- <title>eNtsa Office Location</title>
- </head>
- <body>
- <div id="dvMap" style="width: 500px; height: 500px">
- </div>
- <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=AIz***"></script>
- <script type="text/javascript">
- var markers = @Html.Raw(ViewBag.Markers);
- window.onload = function () {
- var mapOptions = {
- center: new google.maps.LatLng(markers[0].lat, markers[0].lng),
- zoom: 8,
- mapTypeId: google.maps.MapTypeId.ROADMAP
- };
- var infoWindow = new google.maps.InfoWindow();
- var map = new google.maps.Map(document.getElementById("dvMap"), mapOptions);
- for (i = 0; i < markers.length; i++) {
- var data = markers[i]
- var myLatlng = new google.maps.LatLng(data.lat, data.lng);
- var marker = new google.maps.Marker({
- position: myLatlng,
- map: map,
- title: data.title
- });
- (function (marker, data) {
- google.maps.event.addListener(marker, "click", function (e) {
- infoWindow.setContent(data.description);
- infoWindow.open(map, marker);
- });
- })(marker, data);
- }
- }
- </script>
- </body>
-
- </html>