AJAX form submission within modular page not working

Thanks, @pamtbaau, I appreciate this.

I’m also confused—my impression from the docs has been that we needed some html and js code like the below (from the example in the docs) in order for the same-page confirmation message to appear.

<div id="form-result"></div>

<script>
$(document).ready(function(){

    var form = $('#ajax-test-form');
    form.submit(function(e) {
        // prevent form submission
        e.preventDefault();

        // submit the form via Ajax
        $.ajax({
            url: form.attr('action'),
            type: form.attr('method'),
            dataType: 'html',
            data: form.serialize(),
            success: function(result) {
                // Inject the result in the HTML
                $('#form-result').html(result);
            }
        });
    });
});
</script>

Did I misunderstand, or is this no longer the case and the functionality is built in to the form plugin now?

I was referring to your example in this post, which uses the html and js code. It also specifies that the form action goes to an empty pages/forms/ajax-test/form.md. I’m curious about the reasoning for that approach vs the simplicity of what you just shared. Is the earlier example no longer required?