Render ajax response ( without template? )

I’m using gravstrap plugin&theme wherein lies a contact form which plays nicely with the given layout. The gravstrap form simply POSTs to

I gave a go at creating a plugin to receive the POST and use my own mail system to email
the form, instead of posting to simpleforms.

I chose to POST via Ajax and i would like to render a simple HTML response to my “form-messages” div.

All of the information to send the email is available at “OnPluginsInitialized” and I
send email on that event.

So possible questions are:

  1. Can i render a simple response at this point in the grav lifecycle?

  2. How to tell grav to continue/cleanup and move on to the next request.
    $e->stopPropagation() seems to skip remaining events but grav still wants
    to render a page.

  3. If the above in not a good idea, what other approaches might serve the
    roll-your-own “simple” form approach.

  4. If i had to use a template to render the ajax response where to put it?
    or symlink to user/plugins/form/templates from my plugin’s directory
    my plugin route is /postmail

There’s a “How to” in the docs about submitting forms via Ajax.

The upside of using the Grav Form Plugin is that you’ll have full control of the message handling. The downside is adapting the design to match the Gravstrap theme. It’s up to you which way you prefer.