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

215
Visualizações
How to add "?" in string while submitting form with js?

I write a form submit thread with the attr method:

var href = a.attr('href');
if(href =='') return;
if(href.startsWith('http') || href.startsWith('//:')){
  a.attr('href',href.trim());
  if(href.indexOf(location.hostname) > -1){
    return;
  }
  if(href.indexOf('<?php echo $_SERVER['SERVER_NAME']; ?>') > -1){
    return;
  }

  a.attr('href','go.htm?uri='+href);
  a.attr('rel','nofollow');
}

However, it returns the URL without ?, for example, I want to return https://example.abc.com/?ref=abc, the return result will be https://example.abc.com/ref=abc without "?" the question mark.

I'm struggling with solving this and I appreciate any helpful tips.

about 4 years ago · Santiago Gelvez
1 Respostas
Responde à pergunta

0

You can use split function string. Split your URL with "?" and take first element.

var yourRequiredLink = href.replace("?", '')
about 4 years ago · Santiago Gelvez 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