title: jquery find and replace last parameter from a url
body: <p>Hi first of all I've already looked around but there is nothing that matched what I want to happen, so I'm asking if anyone can help me with this.</p>
  
  <p>I have a URL "/view/album/4/photo/1"
  and i want to remove the last parameter and replace it with something.
  What i want to do is to find the last "/" and remove the number after it and replace it with a new value. </p>
  
  <p>It's easy with php but i don't know how to do it in jquery since I just started learning it. So I'd really appreciate anyone who can help. :)</p>
  
  <p>By the way this is my code in getting the url:</p>
  
  <p>action = $(form).attr('action'); // "/view/album/4/photo/1"</p>
  
  <p>I don't know what to do with the variable to change the value of the last param</p>