Exdended the cookie from httpOnly true to false. And fixed a typo in the js.