Move the handleAction inside the ready function. #221

This commit is contained in:
Korina Cordero 2019-06-18 03:26:45 +00:00
parent 3720367ae7
commit 1420493de3

View file

@ -5,7 +5,6 @@
<script>
var form_in_process = false;
var searchManager;
var pin;
var map;
@ -43,9 +42,11 @@ function GetMap()
$('#map_lng').val(locTemp.longitude);
}
}
}
};
var handleAction = function() {
$(function() {
var handleAction = function() {
var text = $.trim($('#m_gmap_address').val());
GMaps.geocode({
address: text,
@ -69,28 +70,25 @@ var handleAction = function() {
});
// set value in hidden input
$('#map_lat').val(locTemp.latitude);
$('#map_lng').val(locTemp.longitude);
$('#map_lat').val(lat);
$('#map_lng').val(lng);
}
},
});
}
};
$('#m_gmap_btn').click(function(e) {
$('#m_gmap_btn').click(function(e) {
e.preventDefault();
handleAction();
});
});
$("#m_gmap_address").keypress(function(e) {
$("#m_gmap_address").keypress(function(e) {
var keycode = (e.keyCode ? e.keyCode : e.which);
if (keycode == '13') {
e.preventDefault();
handleAction();
}
});
$(function() {
});
{% if ftags.set_map_coordinate %}
@ -110,8 +108,8 @@ $(function() {
});
// set value in hidden input
$('#map_lat').val(locTemp.latitude);
$('#map_lng').val(locTemp.longitude);
$('#map_lat').val(location.latitude);
$('#map_lng').val(location.longitude);
// remove placeholder text
$("[data-vehicle-field='1']").prop('placeholder', '');
@ -123,7 +121,7 @@ $(function() {
center: new Microsoft.Maps.Location({{ obj.getCoordinates.getLatitude }},
{{ obj.getCoordinates.getLongitude }}),
culture: 'fil-Latn'
};
});
var dest = new Microsoft.Maps.Location({{ obj.getCoordinates.getLatitude }},
{{ obj.getCoordinates.getLongitude }});
@ -144,5 +142,4 @@ $(function() {
})
);
{% endfor %}
{% endif %}