• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Autocomplete address, city name and street name using AJAX javascript

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can i get the city and street name autocompleted in a form when someone fills the postcode and house number in a html form using AJAX.
Please help me out. I want the addresses only from the Netherlands. Many thanks in advance
 
Marshal
Posts: 25594
69
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The general outline of what you need to do in your JavaScript code is this:

1. You need to have some code which runs when it's clear that the postcode and house number fields have been completely filled in.

2. You need to use AJAX to send those two fields to a service somewhere which will return the related city and street names.

3. Upon receiving the AJAX response you need to extract the city and street names from it and put them into the appropriate fields.

That's just a general outline because your post didn't really discuss what problem you were having. Maybe you can't find a web service which deals with the Dutch addresses for you? Maybe you have no idea how to use AJAX? Could be anything. So let's start from there and see what questions you have based on that.
 
Abinn Gautam
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for your response, I am a beginner in programming, I have an application form where users can fill their informations. All the other functions are working. But I also need to add auto completed city and street fields. And I don’t know where to start from. I have no idea about AJAX.
Thanks again
 
Saloon Keeper
Posts: 6454
158
Android Mac OS X Firefox Browser VI Editor Tomcat Server Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does the backend exist already? Assuming so, do you know what its API is, meaning, what its inputs and outputs are?

I recommend to learn AJAX with a library like jQuery. https://learn.jquery.com/ajax/ and https://www.tutorialspoint.com/jquery/jquery-ajax.htm are some good starting points for that.
 
Abinn Gautam
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes the backend exists . I know a bit about API. And i also know that i need to get a api key inorder to use the api list.
 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use maps JavaScript API in your code it will help for the autocomplete of address,zip code ,state

for further details you follow this link

https://developers.google.com/maps/documentation/javascript/examples/places-autocomplete-addressform
 
You learn how to close your eyes and tell yourself "this just isn't really happening to me." Tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic