- function getLocation(position) {
- if (position) {
- var myLatitude = position.coords.latitude;
- var myLongitude = position.coords.longitude;
- //alert("latitude:"+myLatitude+", longitude:"+myLongitude+", accuracy:"+position.coords.accuracy);
-
- var gc = new BMap.Geocoder();
- var pt = new BMap.Point(myLongitude, myLatitude);
- gc.getLocation(pt, function(rs) {
- var addComp = rs.addressComponents;
- var option = $("<option selected='selected'>").text(addComp.city).val(1);
- $("#select-city").append(option);
- $("#select-city").selectmenu("refresh");
- });
- } else{
- alert(" , !");
- }
- }