title: Jquery to get parameter Id from MVC url?
body: <p>I have the following url : <a href="http://www.xzy.com/AMS/Audit/Agency/10017397" rel="nofollow">http://www.xzy.com/AMS/Audit/Agency/10017397</a></p>
  
  <p>I need to strip out the id: 10017397 from this url?</p>
  
  <p>I tried: </p>
  
  <pre><code>  function GetURLParameter(sParam) {
              var sPageURL = window.location.search.substring(1);
              var sURLVariables = sPageURL.split('&amp;');
              for (var i = 0; i &lt; sURLVariables.length; i++)
              {
                  var sParameterName = sURLVariables[i].split('=');
                  if (sParameterName[0] == sParam)
                  {
                      return sParameterName[1];
                  }
              }
          }
  </code></pre>