title: Append parameter in url without reloading page
body: <p>I am using following code to append param to url. This is working fine but when parameter is appended in url, page is getting reloaded. I want to use this functionality without reloading the page .</p>
  
  <pre><code>function insertParam(key, value)
  {
      key = escape(key); value = escape(value);
  
      var kvp = document.location.search.substr(1).split('&amp;');
  
  
      var i=kvp.length; var x; while(i--) 
      {
          x = kvp[i].split('=');
  
          if (x[0]==key)
          {
                  x[1] = value;
                  kvp[i] = x.join('=');
                      alert('sdfadsf');
                  break;
          }
      }
  
      if(i&lt;0) {kvp[kvp.length] = [key,value].join('=');}
  
      //this will reload the page, it's likely better to store this until finished
      document.location.search = kvp.join('&amp;'); 
      //alert(document.location.href);
  </code></pre>
  
  <h1>    }</h1>
  
  <p>I want to add multiple params to url without reloading the page like:</p>
  
  <ul>
  <li>txt1</li>
  <li>txt2</li>
  <li>txt3</li>
  
  </ul>
  
  <ul>
  <li>link1</li>
  <li>link2</li>
  <li>link3</li>
  
  </ul>
  
  <p>i want url  : "..../search.php"</p>
  
  <p>after click on txt2 
  i want url : "..../search.php#t_2"</p>
  
  <p>after click on link2 
  i want url : "..../search.php#t_1&amp;l_2"</p>