Menu
Examples and frameworks

JavaScript and AJAX

Install a LittleReply form with JavaScript and AJAX.

Integration approach

Use JavaScript and AJAX to render or enhance the public form while LittleReply handles the published schema, durable intake, private inbox, and configured destinations.

Before copying code

  1. Create and publish the form with the exact field names used by the example.
  2. Copy its public key and configure the deployed origin.
  3. Keep recipients and private credentials out of browser code.

Example to adapt

Replace the example key and endpoint, then adapt labels and styles without changing transport names accidentally.

JavaScript
// Keep this identifier while retrying unchanged content.
const attempt = crypto.randomUUID();
const response = await fetch("https://littlereply.com/api/submit", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Idempotency-Key": attempt
  },
  body: JSON.stringify({
    form_key: "YOUR_ACCESS_KEY",
    fields: { name: "Taylor", email: "taylor@example.test", message: "Hello!" }
  })
});
const result = await response.json();
if (!response.ok) throw new Error(result.error?.message || "Submission failed.");
// 202 = stored; email delivery is tracked separately.
console.log("Submission stored", result.request_id);

Verify the result

Check the browser request and response, find the stored submission, then inspect delivery history. Repeat the test on the actual deployed hostname.

Documentation reviewed on October 20, 2026Suggest an improvement →