Javascript

The Javascript example requires support for JSON in browser, e.g. Firefox 3.5 can handle JSON. The example is quite simple, it invokes the thesaurus API with callback=process:


var s = document.createElement("script");
s.src = "http://thesaurus.altervista.org/service.php?word=peace&language=en_US&output=json&key=test_only&callback=process"; // NOTE: replace test_only with your own KEY
document.getElementsByTagName("head")[0].appendChild(s);

function process(result) {
  output = "";
  for (key in result.response) {
    list = result.response[key].list;
    output += list.synonyms+"<br>";
  }
  if (output)
    document.getElementById("synonyms").innerHTML = output;
}


Here is the live demo, that you will be able to see only on JSON capable browsers:

Synonyms of peace:
please wait...
Dictionary | Terms and conditions | Privacy policy