first commit - report data
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
"use strict";
|
||||
|
||||
// initialize map
|
||||
var map = new GMaps({
|
||||
div: '#map',
|
||||
lat: -6.5637928,
|
||||
lng: 106.7535061
|
||||
});
|
||||
|
||||
// when the form is submitted
|
||||
$("#search-form").submit(function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
// initialize map geocode
|
||||
GMaps.geocode({
|
||||
address: $('#address').val(),
|
||||
callback: function(results, status) {
|
||||
if (status == 'OK') {
|
||||
var latlng = results[0].geometry.location;
|
||||
map.setCenter(latlng.lat(), latlng.lng());
|
||||
map.addMarker({
|
||||
lat: latlng.lat(),
|
||||
lng: latlng.lng()
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
Reference in New Issue
Block a user