Www.mappus.co.uk. See registration process.... On Apr 23, 11:49 pm, Isuru Madusanka <[email protected]> wrote: > I am trying to add google maps for my form, so after they enter the address > they can view map and after that maps latitude and longitude submitted to > the database. So far I couldn't implement it. I tried it on jsfiddle and it > worked. But when i try to add to the page it not > working.http://jsfiddle.net/pborreli/pJgyu/ > > Here is the javascript of the page. Tell me if there is any syntax errors. > > <script type="text/javascript" > src="http://maps.google.com/maps/api/js?sensor=false"> </script> > <script type="text/javascript"> > $("#address").change(function() { > var geocoder = new google.maps.Geocoder(); > var add = $("#address").val(); > geocoder.geocode( { 'address': add}, function(results, status) { > if (status == google.maps.GeocoderStatus.OK) { > var latitude = results[0].geometry.location.lat(); > var longitude = results[0].geometry.location.lng(); > var map; > function initialize() { > var myOptions = { > zoom: 8, > center: new google.maps.LatLng(latitude, longitude), > mapTypeId: google.maps.MapTypeId.ROADMAP > }; > map = new google.maps.Map(document.getElementById('map'), > myOptions); > } > > google.maps.event.addDomListener(window, 'load', initialize);}; > }); > > </script> > > And here is the div that I add my map. > > <div class="control-group"> > <label class="control-label" for="input01">Address</label> > <div class="controls"> > <input type="text" class="input-xlarge" id="ad"> > <p class="help-block">To use lines please specify > ‹br/› tag.</p><br/> > <div id="map"></div> > </div> > > I posted this on stackoverflow too, but so far no > answers.http://stackoverflow.com/questions/10289244/google-map-for-a-form > > Thank you!
-- You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.
