I'm trying to get javascript to render an embedded google map once the user's coordinates are obtained.
The code that gets the lat & long works, so I wont show it, but here's the gist of it
<script type="text/javascript">
$(document).ready(function() {
//previous code calculating lat & lng, etc
showMap(lat, lng);
function showMap(lat,lng) {
var apikey = "asdfasdfasdfasdf";
var code = "<iframe width='480' height='320' frameborder='0' style='border:0' src='https://www.google.com/maps/embed/v1/view?zoom=14¢er=" + lat + "," + lng + "&key=" + apikey + "></iframe>";
console.log(code) //outputs good code
$("#map").html(code)
}
}
</script>
Note that this does work....
$("#map").html("<h2>FML</h2>");
That works.
$(document).ready(.......)that closing bracket is missing. after console log;missing