title: Adding a parameter to the URL with JavaScript
body: <p>In a web application that makes use of AJAX calls, I need to submit a request but add a parameter to the end of the URL, for example:</p>
  
  <p>Original URL: </p>
  
  <blockquote>
    <p><a href="http://server/myapp.php?id=10" rel="noreferrer">http://server/myapp.php?id=10</a></p>
  </blockquote>
  
  <p>Resulting URL:</p>
  
  <blockquote>
    <p><a href="http://server/myapp.php?id=10" rel="noreferrer">http://server/myapp.php?id=10</a><strong>&amp;enabled=true</strong></p>
  </blockquote>
  
  <p>Looking for a JavaScript function which parses the URL looking at each parameter, then adds the new parameter or updates the value if one already exists.</p>