Cookies do not update ajax request for enonic service

Enonic version: 7
OS: Ubuntu

Need to update existing cookie from ajax request with frontend. For that, created enonic service and then call service from ajax. But from the service cookie is not update. ookie is htpOnly one and can not use jquery based methods. Do you have any suggetions

Your situation is perhaps not adequately explained, but I’ll try to answer using my best guess.

To set a cookie value from inside a service, the return object in the service handler should contain {cookies: {cookieName: cookieValue}}. See the documentation:

(similarly, you can get cookie values in the request object, explained on the same documentation page I linked to above)

My opinion is that if you’re using a service only to set a cookie value, you should perhaps consider doing that using client-side javascript instead. Using a service seems like overkill unless you also need to do something else server-side. Cookies are stored on the client - not on the server. But maybe I’ve misunderstood your situation.

The cookie is httpOnly one. Due to that I cannot update it using frontend JS