Until we can answer:

  1. Provide the whole function (I assume it’s a function because of the return false in the if statement)
  2. 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.