Today I’m going to show you how you can add an autocomplete address search module on your website using Google Place API web service.
In our autocomplete address search module we have used a Jquery plugin named Select2, for type and search feature to our module.
SEE DEMO HERE
Steps to implement an autocomplete address search module
The first step is to grab a google’s API Key, you can find it here.
index.php
api.php
predictions as $item){
$arr[$i] = array(
'id' => $i,
'text' => $item->description
);
$i++;
}
echo json_encode($arr);
?>
you just have to put above index.html and api.php in the same directory, and you replace {YOUR_API_KEY} with your’s one.
Important Note
By using google place API google simply needs some policy to follow (read this policy here), Google wants their “powered by Google” logo to be shown in the drop-down.
Note:- you need a live or local server to run this module.
To get latest updates please subscribe us and like our page, we are going to post lots of interesting stuff in future.
You may also like
- Get User’s Profile With Linkedin API Using PHP
- Multi Level Nested Category System in Codeigniter and MySql
The post Autocomplete Address Search Module Using Google API and PHP appeared first on My Programming Tutorials.