Why isn't the call
this.submit()
not triggering a submit and calling my controller? The dev tools in Chrome says there is an error and that the function doesn't exist!
$('form').submit(function(e) {
e.preventDefault();
var geocoder = new google.maps.Geocoder();
var address = document.getElementById('SearchQuery').value;
geocoder.geocode({ 'address': address }, function (results, status) {
if (status == google.maps.GeocoderStatus.OK) {
alert("Location found: " + results[0].geometry.location);
$(this).submit();
}
else {
alert("Geocode was not successful for the following reason: " + status);
}
});
});
See Question&Answers more detail:os