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

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

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 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!