i have a anchor like:
<div class="fc-content cursor event_border' onclick="test(edate)"></div>
calling function is given below:
<script type="text/javascript">
function test(id,evntDate)
{
var str = evntDate.toString();
str = str.replace(/\//g,'');
var pathname = window.location.pathname; // Returns path only
var url = window.location.href;
var querystring ='?date='+str;
window.location.replace(url+querystring);
}
</script>
after this i am getting the url like:
localhost/abc/cde?date=2018-07-26
but when i click again on this url its returning me the query string like:
http://localhost/proflyt/dashboard?date=2018-07-26?date=2018-07-24
its not removing the first query string and returning me the url like so because of this i am not able to use my code further can anyone please help me related this ?? i am new in jquery i am stuck here not able to solve and not getting any kind of response please help me related this ..
window.location.hrefwill include the query string. You can build the new URL from the component parts of the location likeprotocol,host, etc.