Is it possible to make asynchronous contact form submissions without a private app?

6 0 0

I am trying to display a contact form inside a modal. I want to show errors/validation and a success message, without having to refresh the page and close my modal. Is there a way to achieve this without having to use or create a private app? 


What I have tried:


1. using the axios library to make a POST request to contact#contact_form. I've gotten it to work, but there is just no way to check for errors this way. The response from the post request is the entire current page in HTML format, and no error messages etc.


2. using an iframe to make the form submission and then grabbing errors from there (Not entirely successful with this approach).


Any suggestions? Thanks...