function approveloan(id) { var url='/auctions/approveloan/' + id; new Ajax.Request(url, { method: 'post', onSuccess: function(transport) { alert('Your loan was updated'); }, onFailure: function(transport) { alert('failed to update loan'); } } ); }