Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

192
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda