GithubHelp home page GithubHelp logo

iashraf / mainland-uk-postcode-checker Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 6 KB

Javascript which checks if a given postcode is part of mainland UK

License: MIT License

JavaScript 93.80% HTML 6.20%
postcode england checker mainland uk wales scotland geocode

mainland-uk-postcode-checker's Introduction

#Mainland UK postcode checker

A simple script that checks if a given postcode is part of mainland UK - so England, Scotland and Wales. It assumes that the anything offshore (Isle of Man, Isle of Wight, Shetland Islands, etc) are not part of mainland UK.

Especially handy for UK based online shops who don't want to ship offshore.

##Prerequisites

  • jQuery
  • Google Geocode API key (potentially - the example doesn't use one)

##Quick run-through

  • User provides postcode
  • Postcode is checked against a pre-defined list of non-mainland British isles postcodes
  • If postcode matches any in the list, then it's not part of mainland UK, so show a message (or do something) and exit
  • If postcode doesn't match, then pass postcode through to Google Geocode API
  • Check API response to see if it includes the terms "England", "Scotland" or "Wales"
  • If it does, then the postcode is part of mainland UK... show a message or do something if you want (and exit)
  • If it doesn't, then the postcode is not part of mainland UK, so show a message (or do something) and exit

mainland-uk-postcode-checker's People

Contributors

iashraf avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.