React & JavaScript
Set the form's submit behaviour to JSON, then post with fetch. Send Accept: application/json so you always get a JSON response.
async function onSubmit(e) {
e.preventDefault();
const data = Object.fromEntries(new FormData(e.target));
const res = await fetch("https://senduler.com/f/your-key", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Accept": "application/json",
},
body: JSON.stringify(data),
});
if (res.ok) {
// { ok: true, id: "..." }
setSent(true);
}
}
Allowed origins
Lock a form to your domain(s) in Settings → Allowed origins. Cross-origin requests from anywhere else are rejected, and the browser preflight is handled for you.
File uploads
Use multipart/form-data (a normal form with an <input type="file">) and the files
are stored against the submission, subject to your plan's size limits.