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

223
Visualizações
Append URL with a querystring using JavaScript or jQuery

I have a program that generates a web page that contains a button. I want to be able to append the URL for that button. tblSubscriptionlist.asp to tblSubscriptionlist.asp?Type=3 The generated element looks like this:

<a class="ewGridInsert" title="" data-caption="Insert" href="" onclick="return ewForms(this).Submit('tblSubscriptionlist.asp');" style="margin-right: 10px;" data-original-title="Insert"><span data-phrase="GridInsertLink" class="glyphicon ewIcon" data-caption="Insert" style="font-weight: 800;">Submit</span></a>

I tried:

$('.ewGridInsert').attr("href",onclick="return ewForms(this).Submit('tblSubscriptionlist.asp?type=3');");

but it added to the href not the actual URL.

Any assistance would be appreciated.

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

0

This is a loaded situation because the <a/> tag link is not being used as a normal hyperlink, but overridden as a form submission link.

You need to decide whether you want the link to submit a form, or navigate to somewhere else using the 'href' attribute. Doing both is not really viable.

It appears to be committing to the 'onclick' attribute, and abandoning the 'href' attribute. So, your solution needs to be focused around what the 'onclick' attribute is accomplishing. If it is actually submitting the <form> it resides in, then perhaps you should add a hidden <input/> to this form with the 'name' "Type" and give it a 'value' of 3.

<input type="hidden" name="Type" value="3" />

When the <form> submits, assuming it's a GET type of HTTP request, the hidden input's name and value will get appended to the end of the GET request's URL, like you've described.

But, if I'm missing something, please clarify what else is going on and we can work it out further.

Also, does the parameter "Type" need to have a capitalized 'T'? (The original question has it capitalized while the edit to the question has it in lowercase.)

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