0
我想运行以下地理位置代码,但下面的代码返回undefined。任何人都可以指导我请地理位置代码返回undefined
当我打电话例如
警报(verifylocation())的功能;
它返回未定义。我想用这个表单验证
<script src="//maps.googleapis.com/maps/api/js?key=<?=$google_api_key?>&sensor=false" type="text/javascript"></script>
<script language="javascript">
var geocoder, location1, location2, radius_verified;
geocoder = new google.maps.Geocoder();
radius_verified = - 1;
var Zone1, Zone1_enabled;
var Zone2, Zone2_enabled;
var Zone3, Zone3_enabled;
window.verifylocation = function() {
\t var restaurant_location = '<?= $objRestaurant->rest_address . ", " . $objRestaurant->rest_city . ", " . $objRestaurant->rest_state; ?>';
\t var customer_location = $("#customer_address").val() + " , " + $("#customer_city").val() + " , " + $("#customer_state").val();
\t
var radius = '<?= $objRestaurant->delivery_radius ?>';
\t
geocoder.geocode({'address': restaurant_location}, function(results, status) {
\t \t // Here is my Code but before my code run it returns undefined.
});
};
什么变量未定义? – Griffith
当我调用函数例如alert(verifylocation()) –
你没有返回函数中的任何值。你想要返回什么? – Griffith