Changing an HREF value

Changing an HREF value

What is a good way to switch a number at the end of a string?

Im trying to change the value 0 to value 1 at the end of a URL when a button is clicked. (And vise-versa)

So if I have this:
  1. <a class="important_ajax" href="projects/important_ajax/0"></a>

Them the part here should be simple but im unsure of a good way to do this easily:
  1. $(".important_ajax").click(function() {
  2. $obj = $(this); // So I can use THIS object inside of other objects.
  3. $url = $obj.attr('href'); // This is the URL: projects/important_ajax/0

  4. // How can i make that link's last digit in the HREF turn to a 1 here?

  5. // So it turns into this:
  6. // projects/important_ajax/1

  7. return false;
  8. });