title: Get last part of url using jQuery
body: <p>How can I get the last parameter of the URL using jQuery. For example in following URL I want to get 1.</p>
  
  <pre><code>localhost/x/y/page/1/
  </code></pre>
  
  <p>I'm trying following</p>
  
  <pre><code>var url = $(location).attr('href');
  var parts = url.split("/");
  var last_part = parts[parts.length-1];
  alert(last_part);
  </code></pre>
  
  <p>It returns empty value.</p>