1

代码在这部分停止,没有其他任何事情发生它通过条件然后停止它不会触发任何回调被卡在这里&我的应用程序无法交付。

src = "//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js";
src = "//maps.google.com/maps?file=api&v=2.x&key=AIzaSyD4iE2xVSpkLLOXoyqT-RuPwURN3ddScAI";

function getLocation() {
    if (navigator && navigator.geolocation) {
        navigator.geolocation.getCurrentPosition(success);
    }
}

function success(position) {
    //Trials.GetLocationService.setLocation("F"); just testing something i commented it out so it's not the proplem
    printAddress(position.coords.latitude, position.coords.longitude);
}

function printAddress(latitude, longitude) {
    // set up the Geocoder object
    var geocoder = new google.maps.Geocoder();

    // turn coordinates into an object
    var yourLocation = new google.maps.LatLng(latitude, longitude);

    // find out info about our location
    geocoder.geocode({ 'latLng': yourLocation }, function (results, status) {
        if (status == google.maps.GeocoderStatus.OK) {
            if (results[0]) {
                $('body').append('<p>Your Address:<br />' +
                    results[0].formatted_address + '</p>');
            } else {
                error('Google did not return any results.');
            }
        } else {
            error("Reverse Geocoding failed due to: " + status);
        }
    });
}
4

0 回答 0