Until we can answer:
- Provide the whole function (I assume it’s a function because of the
return false in the if statement)
- Provide any errors from server/client console.
The whole thing should work as far as I know. According to the docs, it looks good. Also please check this post, which has very similar code.