Skip navigation

Category Archives: Javascript

OK, this is a simple way to get your postcode/ address location returned and displayed via the Google Maps API on your own website. I’ll cover the ‘nearest store locator’ scenario in another post where you want places with a certain radius of an inputted postcode/ town returned.

First of all we need to retrieve our results which should already be stored with a geocoded result using the previous tutorial here. remember that in order for this to work you need an API key from google – again check the previous tutorial for more info on this.

Google Maps API part 2: Retrieving Postcodes from your database

Really quick and simple code in order to show or hide a layer on your webpage using Javascript. This can be used as the basis for things such image galleries, video popups and if you have no soul then it can be used for web advertising

Effectively what we do is define a layer in CSS and then write a couple of functions, one to set the visibility and position of the layer and the other to find the position on the page that it should appear. You can then add whatever you want inside the layer ready to be shown or hidden when a user clicks a link, or anyother way to activate the function.

Quick popup/overlay show and hide a layer with Javascript and CSS

Why would you need to do this? Well for instance if you were using 3rd party AJAX APIs and you wanted to capture the data from them perhaps, or maybe you just have a complex form.

Or you could use this for form validation to return errors from the server without refreshing the browser, for example, if the data already exists in a database you could let the user know.

Either way its pretty simple. Basically we just use javascript to post the form object over http to a serverside page – e.g. PHP, JSP, ASP etc…

More here: Using Javascript/ AJAX to post HTML form data

Recently I had to build a system that would take an address, pass it to google and return latitude and longitude values. The result is then stored for later use and display on Google maps.

However, firstly I found that the default XML geocoding service provided by Google that allows you to do bulk geocoding on a data source and the geocoding provided by their maps API/ AJAX library (GClientGeocoder) had huge differences in results. Most postal codes passed to googles XML geocoding service were miles out or just not recognised. Yet when using the same postcode in the maps API when calculated on the fly the results were more or less spot on.

More here:Google Maps API part 1: Accurate Geocoding for UK Postcodes

And then filter an XML file based on the values passed from the URL.

If you’re not aware, Adobe now has it’s own AJAX/Javascript library called SPRY for you to use and better yet they include this with Dreamweaver CS3. I assume that you already probably know of or use SPRY.

Read the full article on my new blog

Follow

Get every new post delivered to your Inbox.