How to add error messages to my users when something wrong?

when this site is not spelled correctly or if this site is at the time of using in my application is not responding then i want to show the error message in the browser.Likewise,some other error messages and success messages are also i want to show to the user in browser if user post their data to server then show "new user data added successfully". that's it. Thank You!

based on the server response code you can customize the messages

Little markdown supported