Added functionality for error message to flash using jQuery in main.php.