// We have just 'created' a Letter Completion resource on the server // (in other words we have updated the letter state to Completed!) and now we // need to refresh the view the user was on. This could be any page // were the letter is listed or displayed. So look for a URL stored // somewhere on the page in a data attribute and if found make an AJAX call // which will probably reload e.g. a letters table or something like that. url = $(".reveal-modal").data("refresh-url"); if(url) { $.getScript(url); }