JS field doesn't accept Google Maps API library for external resources. (I'm not sure why) So you need to insert <script>tag into the body field.
And JS field generates "window.onload" automatically. You don't have to write "google.maps.event.addDomListener" in JS field.
http://jsfiddle.net/wf9a5m75/NpYwE/27/
<div id="panel" style="margin-left: -260px">
<input id="searchTextField" type="text" size="50">
<input type="radio" name="type" id="changetype-all" checked="checked">
<label for="changetype-all">All</label>
<input type="radio" name="type" id="changetype-establishment">
<label for="changetype-establishment">Establishments</label>
<input type="radio" name="type" id="changetype-geocode">
<label for="changetype-geocode">Geocodes</lable>
</div>
<div id="map-canvas"></div>
<script src="http://maps.google.com/maps/api/js?sensor=false&libraries=places"></script>
Answer from wf9a5m75 on Stack OverflowVideos
JS field doesn't accept Google Maps API library for external resources. (I'm not sure why) So you need to insert <script>tag into the body field.
And JS field generates "window.onload" automatically. You don't have to write "google.maps.event.addDomListener" in JS field.
http://jsfiddle.net/wf9a5m75/NpYwE/27/
<div id="panel" style="margin-left: -260px">
<input id="searchTextField" type="text" size="50">
<input type="radio" name="type" id="changetype-all" checked="checked">
<label for="changetype-all">All</label>
<input type="radio" name="type" id="changetype-establishment">
<label for="changetype-establishment">Establishments</label>
<input type="radio" name="type" id="changetype-geocode">
<label for="changetype-geocode">Geocodes</lable>
</div>
<div id="map-canvas"></div>
<script src="http://maps.google.com/maps/api/js?sensor=false&libraries=places"></script>
You will notice the errors in the javascript console:
Failed to load resource: the server responded with a status of 404 (Not Found) http://fiddle.jshell.net/maps/documentation/javascript/examples/default.css
Uncaught ReferenceError: google is not defined fiddle.jshell.net/agconti/NpYwE/show/:133
You aren't including the google API script correctly on the fiddle.
It looks like there is no convenient UI for just querying it from the web. Instead, just consult the Places API documentation, and paste a query of the following style, for example, into your browser address bar.
https://maps.googleapis.com/maps/api/place/findplacefromtext/json?key=YOUR_API_KEY&inputtype=textquery&input=Starbucks
Use a server key for the web service, as stated in the documentation:
Get a key for Google Places API Web Service
- Go to the Google Developers Console.
- Create or select a project.
- Click Continue to Enable the API.
- Go to Credentials to get a Server key (and set the API credentials).
- To prevent quota theft, secure your API key following these best practices.