Created
April 25, 2012 14:48
-
-
Save battlejj/2490289 to your computer and use it in GitHub Desktop.
Form won't submit like this
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $('#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