Answer the question
In order to leave comments, you need to log in
How to convert an array to a get-like string?
Hello. I have a filter on my site that works without reloading the page. I would like that in case of reboot - the data of the form was saved. As I understand it, I just need to change the user's url with the filter parameters in parallel. As a result, I have something like this array:
{
filtr: "_created",
status: {"Принят", "Отклонён", "Завершён"},
limit: 8
}
history.pushState(null, null, '/adm?'+array);
Answer the question
In order to leave comments, you need to log in
The simplest is to use a module. For example, query-string . It provides a more convenient API than the native URLSearchParams .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question