user3093175
user3093175

Reputation: 61

Uncaught SyntaxError: Unexpected end of input Google Maps API

I'm getting this from my console when I debug it Uncaught SyntaxError: Unexpected end of input.

Here's my html:

<script type="text/javascript">
        src="https://maps.googleapis.com/maps/api/js?key=MYKEYHERE&sensor=false">
</script>
<div id="map"></div>

And my Javascript:

var mapOptions = {
    center: new google.maps.LatLng(30.249281,-97.81305),
    zoom: 12,
    mapTypeId: google.maps.MapTypeId.ROADMAP
};
    var map = new google.maps.Map(document.getElementById('map'), mapOptions);

var markerOptions = {
    position: new google.maps.LatLng(30.283288,-97.824286)
};
var marker = new google.maps.Marker(markerOptions);
marker.setMap(map);

I fixed the hanging tag, but my map still isn't showing.

Upvotes: 0

Views: 1568

Answers (2)

Krish R
Krish R

Reputation: 22721

You script tag should be like,

 <script type="text/javascript"  src="https://maps.googleapis.com/maps/api/js?key=MYKEYHERE&sensor=false"> </script>

Upvotes: 1

karthikr
karthikr

Reputation: 99670

You have a dangling >

<script type="text/javascript">
    src="https://maps.googleapis.com/maps/api/js?key=MYKEYHERE&sensor=false">
</script>

should be

<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=MYKEYHERE&sensor=false"></script>
                              ^ remove the > here

Upvotes: 2

Related Questions