I am setting a new value in the window.location.href and then reload the page with the appended query string but it is not working for me. Below is the code snippet i use
if(window.location.search == "")
var queryurl = window.location.protocol + ‘//’ + window.location.hostname + window.location.pathname + ‘?enrollCustID=’ + $(‘#hiddenCustomerId’).val();
window.location.href = queryurl;
Note: when i alert the value then the above code works sometimes. So i tried setTimeOut on the window.location.reload(true) but it was not working.
What if you comment the "reload" line? Assigning location.href is enough to navigate to the new page and reload reloads the current page so using both might be counter productive.
Also generally rather than " it is not working" it’s always better to describe what happens (does it stay on the current page?)