@brettchalupa quickly took a stab at it. This replicates what you have here with a bit less logic.

```javascript
  $(".manage-cookbook-urls .edit_cookbook").on('ajax:success', function() {
    $.get('', function(data) {
      $('.cookbook-urls').replaceWith($(data).find('.cookbook-urls'));
      $('.cookbook-urls').show();
      $(".show-cookbook-urls-manage").show();
      $('.manage-cookbook-urls').hide();

      $(".page").append(
        '<div data-alert class="alert-box success"><div>The cookbook URLs were successfully saved.</div> <a href="#" class="close">&times;</a></div>'
      );
    });
  });
```