B
B
Bogdan2018-02-27 15:58:00
JavaScript
Bogdan, 2018-02-27 15:58:00

Get cookies from response?

Hello. Can you please tell me how to get and save cookies when responding from the server with AJAX?

fetch( url )
        .then( response => {
            
            console.log(response.headers); // выводит пустой объект,
            console.log(document.cookie) // Тут тоже пусто

return response.json( );
} )
Although if you receive a request in postman, then there are cookies
5a9555d53ded5112238567.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Evgeny Kalibrov, 2018-02-27
@rework

The browser does this automatically, based on http headers. There is no need to do it with a script.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question