I manage to copy/write/edit this code, but it doesn't seem to work, not even alert();
is executed, it does exactly nothing.
<?php // include "from_db.php"; ?>
<!DOCTYPE html>
<html>
<head>
<script src="http://maps.googleapis.com/maps/api/js"></script>
<script src="http://code.jquery.com/jquery-1.11.2.min.js"></script>
<link rel="stylesheet" href="styles.css" media="screen" />
<script>
function initialize() {
var mapProp = {
center: new google.maps.LatLng(51.509, -0.121),
zoom: 5,
mapTypeId:google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("googleMap"), mapProp);
}
google.maps.event.addDomListener(window, "load", initialize);
</script>
</head>
<body>
<div id="googleMap"> </div>
<input type="text" id="input" placeholder="Placename..." />
<script>
$("#input").keyup(function (e) {
if (e.keyCode == 13) {
alert("Linux deyum!");
var address = document.getElementById("address").value;
geocoder.geocode( { 'address': address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
map.setCenter(results[0].geometry.location);
var marker = new google.maps.Marker({
map: map,
position: results[0].geometry.location
});
alert(marker);
}
else {
alert("Geocode was not successful for the following reason: " + status);
}
});
}
}
</script>
</body>
</html>