Any ideas why I am getting “I’m getting “wp-admin/admin-ajax.php 401 (Unauthorized)”

It’s working, I traced it by digging through admin-ajax.php to see what was responding with 401/400. My fix was basically making the action parameter the last thing appended to the formData

    formData.append("enquiry", form);
    formData.append("action", "enquiry");

I don’t normally use formData to post things, .serialize() has always been enough for me over the years. As I spend most of my time doing C# and PHP using JSON without the WordPress overhead I just assumed the same things not taking into consideration you need to hook into WordPress to make everything behave.

But I do vaguely recall something (non-WordPress) from a fair while back about the order of items added to formData, Or I might just have dreamt it.

@Tom: I’d still be interested to hear more about the REST solution.