'Using google maps distance matrix API - javascript

I am trying to run teh example from here: "https://jsfiddle.net/3b03m5mt/"

Apparently, works when refreshing the page. Using this code only in a project that I've created returns - "Error was: REQUEST_DENIED".

Once it works, I will use it in a larger project, but need to understand why it fails. Please help throubleshooting.

Thank you



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source