Cookies, while available from JavaScript, are not a JavaScript-specific mechansism. Cookies are available on the server-side via the getCookies() method of the request isntance.
But why use cookies? If you are going to be making a request back to the server, why not just use good old request params?