Geo located Google Maps address validation freezing -
i using google maps api convert latitude/longitude street address, , doing validation on address returns.
i want finish address, street number , street name, no corners , no freeways. code keeps freezing when gets next section:
var geoaddress = formatted_address.split(/,(.+)/)[0]; var geozip = formatted_address.match(/ca (.*?),/i)[1]; var matches1 = geoaddress.match(/\d+/g); var matches2 =geoaddress.match(/^\d+$/) if( geoaddress.indexof( "freeway" ) !== -1 ) { alert('we cannot send cab freeway, please phone call 411'); document.getelementbyid('map_dragged').innerhtml = '<img src="/images/alert.png" style="vertical-align:middle"/> cannot pickup on freeway, phone call 411'; } else if (matches1 == null) { document.getelementbyid('map_dragged').innerhtml = '<img src="/images/alert.png" style="vertical-align:middle"/> not valid address, please seek again'; } else if (matches2 != null) { document.getelementbyid('map_dragged').innerhtml = '<img src="/images/alert.png" style="vertical-align:middle"/>not valid address, please seek again'; }else { //valid address }
how can write little more efficiently?
google-maps
No comments:
Post a Comment