Returning Values from a function

I've got some javascript doing a bunch of stuff and in the middle of it I need to get a colour based on a value in my function and a call to the database. I've been messing around with my function getCoverageColourCode and neither version works the way I want.

when I view the console I get
Success: #0e2b08
colour about to be applied: undefined
Click to expand...
What am I missing that my the variable colour in drawStuff isn't catching the returned value?

function drawStuff(position){... Code (markup):

Returning Values from a function

Poster :