function flushAttributeCacheImages(flushUrl, targetButton) { if (targetButton.className.indexOf('disabled') != -1) { return false; } if (confirm('Do you want flush attribute cache images?')) { new Ajax.Request(flushUrl, { method: 'post', parameters: {}, onSuccess: function (data) { var response = data['responseText'].evalJSON(); if (response.status == 'success') { targetButton.className = targetButton.className + " disabled"; } } }); } return false; }