I have Google maps on my page, my visitors can drag a maker from outside of the google maps canvas window and on the release of the marker an input field is populated.
My function works fine in all browsers but ie9.
function GetLocation(location) {
var result;
$.ajax({
url: "http://maps.googleapis.com/maps/api/geocode/json?address=" + location + "&components=country:UK&sensor=false",
async: false,
type: "POST",
success: function (data) {
result = data;
alert("result: " + result);
}
});
return result;
}
$(".startPoint").draggable({
helper: 'clone',
stop: function (e, ui) {
var mOffset = $(map.getDiv()).offset();
var point = new google.maps.Point(
ui.offset.left - mOffset.left + (ui.helper.width() / 2),
ui.offset.top - mOffset.top + (ui.helper.height()));
var ll = overlay.getProjection().fromContainerPixelToLatLng(point);
var address = GetAddress(ll.k, ll.B);
if (address.status == 'OK') {
placeMarker(ll, address.results[0].formatted_address, 'img/startLoc.png', $('#startLocation'));
$('#startLocation').val(address.results[0].formatted_address);
} else {
alert('Could not find an address');
}
}
});
The above fails and I've no idea why - can anybody advise me in the best way to debug this issue?
Console Errors
Unable to get the value of the property 'status': object is null or undefined