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>
Member Avatar for diafol

Thanks for the info. I'll be sure not to use it.

...or were you asking a question?

>.>, that guy though.

Yes, it is a question. I thought the sentence was clear enough to throw that itself at the reader.

Not sure if this is the only reason, but you're not closing your jQuery function properly.

$("#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);
            }
        });
    }
});
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.