Javascript – How to get random word using Wordnik API in Javascript


I am trying to create a hangman game using HTML and Javascript and to get the word I was wondering how I might be able to get a random word using the wordnik API.

I do not understand how to get the word and then return in. I've already registered for an apiKey, but I keep getting confused on how to do the AJAX and JSON part of the API and how that combines with the Javascript.

Best Solution

According to a quick search of the docs, you should be able to get a list of random words via:

Effectively, you're looking for a list of random words, with a limit of one word (limit=1).

Obviously, use your own api_key rather than the demo key provided in the documentation.