I’m trying to get the map to recenter and zoom after user inputs ZIP or address in a form field.
I’ve gotten the form ajax working and returning the lat & lng, but the page is crashing when I try to use the ajax response in the mapp0.setCenter() method.
Here is my ajax call:
jQuery("#zoomer").submit(function() {
var address = jQuery('#address').val();
jQuery.ajax({
url: "<?php echo admin_url('admin-ajax.php'); ?>",
type: 'POST',
data: {
action: 'map_zoom',
address: address
},
success: function(response) {
//alert(response);
jQuery(mapp0.setCenter(response));
jQuery(mapp0.setZoom(9));
}
});
return false;
});
Any ideas?
Thanks.