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,7 +42,9 @@ function GetMap()
$('#map_lng').val(locTemp.longitude);
}
}
}
};
$(function() {
var handleAction = function() {
var text = $.trim($('#m_gmap_address').val());
@ -69,12 +70,12 @@ 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) {
e.preventDefault();
@ -90,9 +91,6 @@ $("#m_gmap_address").keypress(function(e) {
});
$(function() {
{% if ftags.set_map_coordinate %}
// check if we need to set map
var location = new Microsoft.Maps.Location({{ obj.getCoordinates.getLatitude }}, {{ obj.getCoordinates.getLongitude }});
@ -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 %}