Apart from me being muppet and specifying the variable like php variable with a '$'....
Just to note, it is perfectly valid to use PHP style variables (with a '$' prefix) in JS. In fact more developers seem to be doing this.
I didn't know that I could use php style variables either, so thanks for putting me straight on that. I can understand why. As I spend about 80% of my coding time in PHP, I get used to recognizing variables with a $ in front of them. It will certainly help to be consistent.