Implementation of the showAlert function.