-1

I have to calculate bonus. On the first page two options: yes and no.

If I select yes, piccal.html?value=yes

<a onClick="window.location.replace('piccal.html?value=yes')">

When I select no, piccal.html?value=no

<a onClick="window.location.replace('piccal.html?value=no')">

If I have yes then calculate to bonus otherwise not

On calculator page there are 3 links to other pages.

<a href="piccal.html" class="btn noselect"></a>         
<a href="picinfo.html" class="btn noselect">PIC Grant Information</a>
<a href="#">Contact Us</a>

piccal.html is a calculator page if i will select this link from inside then i have no value "yes" or "no" . how to set url yes or no value as default for all page if any value selected from another page

I think you are getting my question. Thanks in advance

Ashish Mishra
  • 165
  • 1
  • 1
  • 9

2 Answers2

1

If you're asking what I think, then you want to persist the querystring from page to page. This can be simple or very involved, depending on many other factors, but this is a simple answer that will work if none of your links have querystrings in them.

jQuery(function($) {
    if (location.search !== "") {
        $("a").each(function() {
            this.href += location.search
        });
    }
});

Put that code in a js file and include it in every page that you need to persist the querystring. It will add the querystring to the href value of every link on the page. Is it perfect? Absolutely not, but it will resolve this particular scenario you describe.

Reinstate Monica Cellio
  • 25,975
  • 6
  • 51
  • 67
0

try

function setUrl(newUrl, force) {
    if (url === newUrl && !force) {
         return;
     }
     url = newUrl;
     $iframe.attr('src', newUrl + '?_app_platform=' + os);
     $url.each(function () {
         if ($(this).data('url') === newUrl) {
             $(this).addClass('active');
         } else {
             $(this).removeClass('active');
         }
     });
 }
JoniS
  • 89
  • 9
  • 11