Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

222
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!