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