not sure if this should be done in javascript or something else. Basically, I have a little quiz type thing where all questions are on a single page. I have an ajax function which checks what question it is, and if it is the last question, it will redirect the user to a new page e.g.
if(totalScore <= 10) {
$.ajax({
method: "POST",
url: "php/handleData.php",
data: { answers: ansArray, page: window.location.href, pt: "aa" }
}).done(function( response ) {
window.location.replace("page2.html" + '?le=' + le + '&ch=' + ch);
}).fail(function( jqXHR, textStatus ) {
console.log( "Request failed: " + textStatus );
window.location.replace("page2.html" + '?le=' + le + '&ch=' + ch);
});
return false;
}
As you can see, the redirect also includes some additional parameters. Therefore, when I am redirected, I am on a page like
page2.html?le=1&ch=2
Now I dont necessarily need these params in this url, but it is the only way I could think about getting them over to page2. Page 2 has a button on it like
<a href="www.link1.com>" target="_blank" class="btn btn-primary" role="button">Visit link1.com ></a>
It is in this href where I need the params le and ch to be injected.
How would I go about doing this?
Thanks