Created alert view function