Submit a form through ajax and display error or confirmation message.