0

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.

1

2 Answers 2

2

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
Sign up to request clarification or add additional context in comments.

9 Comments

I fixed that, do you have any idea why my map still wouldn't be showing? My CSS looks like this: #map { height: 300px; width: 300px; margin: 0; }
ok 2 things: 1. Load jquery before the api calls. 2. Create a fiddle if that doesnt fix the issue
Here is my jfiddle jsfiddle.net/#&togetherjs=IEMNPtIzr4 and my apologies I'm very new to JS. You have been really helpful.
It works: jsfiddle.net/yvk76 Just look hard to see the difference. Couple of minor issues
Quick question. Would you know if I'm using coda, and I launch a preview into chrome that it would stop this from working?
|
1

You script tag should be like,

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.