Skip to content

Instantly share code, notes, and snippets.

@battlejj
Created April 25, 2012 14:48
Show Gist options
  • Save battlejj/2490289 to your computer and use it in GitHub Desktop.
Save battlejj/2490289 to your computer and use it in GitHub Desktop.
Form won't submit like this
$('#createForm').bind("submit",function(e){
//stop default form submission
e.preventDefault();
//check the persons address, make sure it exists in google maps
findLocation();
//hook to listings form jquery object
$self = $(this);
//we need about a second or 2 to wait on the response from google maps to get the
//driving distance and driving time estimates before submitting on a success
window.setTimeout(function(){
//if locationFound is now true, then submit the form normally, otherwise we've
//already informed the user their address wasnt found in the findLocation function
if (locationFound) {
$self.unbind();
$self.submit();
}
}, 1500);
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment