Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

275
Visualizações
How to navigate to another page with preselected value without query params JS

I have a question. I'm working on website written in pure JS. I have a button on homepage mypage.com and when I click on it, it navigates to another page mypage.com/list. The button is just a simple a tag with href attr.

A client want me to do mypage.com/list with preselected option, but the url doesn't contain query params. My select component has a few options and when I click on an option I fetch some data from external API based on an url. Both mypage.com/list is the same all the time, when I change the options.

I need navigate to mypage.com/list, and save info with a value = option1.

It is simple image that shows how it is now and how it must be. enter image description here

Do you know how to solve it? How to redirect with preselected option without params? Is a place when could I store info about a picked option? localStorage maybe?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

The option I see if you're not using a state handler in the app is localStorage:

In mypage.com
// Create a key-value
localStorage.setItem('option', 'value');

In mypage.com/list
// Get value
let value = localStorage.getItem('option');
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda