Loading...
Feedback
LonelyDrops API

Browser compatibility and previous requirements

 
LEGAL NOTICE. PLEASE READ THE FOLLOWING TERMS OF USE CAREFULLY BEFORE USING THIS SERVICE

Browser compatbility

Lonelydrops API works fine under the following browsers:

  • Firefox 2.0 or later
  • Internet Explorer 6.x or later
  • Safari 4.0 or later

Previous requirements

For running lonelydrops API on a web browser you'll need to load the core file of JQuery library (in version 1.2.6 or later). JQuery library can either be downloaded from JQuery Official website:

http://jquery.com

or retrieved in runtime from Google javascript library servers by inserting two lines of code in your html pages.

<script src="http://www.google.com/jsapi"></script>
<script> google.load("jquery", "1.2.6"); </script>

API basics

 
Lonelydrops API has been split into different javascript files, accessible under the following urls:

CORE JAVASCRIPT FILE

http://www.lonelydrops.com/drops/1.0/core.js

Contains the core Javascript functions (always required)

A LIST FILE (grouped by its parent list if exists)

http://www.lonelydrops.com/drops/1.0/list/language_code/list_code

Contains all data necessary to build a specific list identified by code (list_code) under a specific language (language_code)

For example,
http://www.lonelydrops.com/drops/1.0/list/en/countries

In case list is needed ungrouped, the url should be called in the following form:

http://www.lonelydrops.com/drops/1.0/list/language_code/list_code/ungrouped

WHAT IS THIS UNGROUPING THING?

Normally, lists are grouped by its parent list (if this parent list exists). For example, list of countries is usually delivered grouped by its parent list which is continent list. In some cases, grouping might not be desirable. For example, timezones are grouped by country but as some countries may contain just one single timezone, grouping by country doesn't seem to provide any new information to the list (but increasing its lenght unnecessarily). In these cases, lists can be delivered ungrouped, by adding the ungrouped word at the end of the url.

For example,
http://www.lonelydrops.com/drops/1.0/list/en/timezones_by_country/ungrouped

AVAILABLE LISTS

AVAILABLE LANGUAGES

list codelist content
countriesContains a list of countries
continentsContains a list of continents
timezones_by_countryContains a list of timezones
spain_autonomiesList of spanish autonomies
spain_provincesList of spanish provinces grouped by spanish autonomy
spain_townsList of spanish towns grouped by spanish province
language codelanguage
enEnglish
esSpanish
caCatalan

Find out more? Learn by example

 

Javascript functions

 

drops.fillSelect(config)

Fills and configures an html SELECT element according to config object.

    config may contain the following labeled elements:

    • id: Contains the SELECT element identifier
    • code: Contains the primary code associated to the list to be loaded in the SELECT element
    • parent (optional): May contain a value of the parent list (a value element of another list) this list will be filtered by
    • lang (optional): Defines the language of the human-readable labels (if not present, english will be set by default)
    • allowVoid (optional): Indicates whether the SELECT should contain an initial void element (if not present, allowVoid will be set to false)
    • voidMessage: Contains the message to be displayed for void element (if not present and allowVoid=true, initial void element will be left blank)
    • def (optional): Defines the default value for this list to be selected by default (if not present, first/or none is selected depending on allowVoid field)
    • onChange (optional): Contains a void function definition that will be called at any time the SELECT changes its value. No arguments will be passed when calling this function (see some examples to find out how it works)

    NOTE: Script file in the form:
    http://www.lonelydrops.com/drops/1.0/list/language_code/list_code must be preloaded first.

drops.getLabel(code, currValue, lang)

Returns a human-readable text label for the list defined by 'code' and a selected value of 'currValue' in 'lang' language

NOTE: Script file in the form:
http://www.lonelydrops.com/drops/1.0/list/language_code/list_code must be preloaded first.

Find out more? Learn by example

 
© 2014  • General website conditions  • Terms and Conditions for LonelyDrops API Service