add js function to show notice and error