addToBasket = (id, qty) ->
if $.cookie('basket')?
# Basket exists
basket = $.parseJSON($.cookie('basket'))
basket.push( { 'id': id, 'qty': qty } )
$.cookie('basket', JSON.stringify(basket))
else
# Basket doesn't exist
alert 'Creating basket'
basket = JSON.parse([{'id': id, 'qty': qty}])
$.cookie('basket', JSON.stringify(basket))
I'm tearing my hair out; I cannot get the (compiled equivalent) function to run, always getting the illegal token error. I've checked for rogue, invisible characters and there's nothing besides CR/LFs in there.