Submit form without refresh

Submit form without refresh

I was googling how to submit contact form without refreshing. I found some plugin. As about success message I guess this is impossible for ajax to know if the message is actually emailed on php part? Right? Or how the code should be to know if this is actually emailed without error?