{"id":16151560,"url":"https://github.com/justinmahar/simple-form-submit","last_synced_at":"2026-02-23T21:45:42.090Z","repository":{"id":39004422,"uuid":"190960754","full_name":"justinmahar/simple-form-submit","owner":"justinmahar","description":"✅ Submit your form data with a simple JavaScript call.","archived":false,"fork":false,"pushed_at":"2025-02-18T02:35:51.000Z","size":5627,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-22T04:17:37.574Z","etag":null,"topics":["form","forms","submit"],"latest_commit_sha":null,"homepage":"https://justinmahar.github.io/simple-form-submit/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/justinmahar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"justinmahar","custom":"https://www.paypal.com/paypalme/thejustinmahar/5"}},"created_at":"2019-06-09T03:41:33.000Z","updated_at":"2025-02-18T02:34:59.000Z","dependencies_parsed_at":"2024-02-09T23:27:14.263Z","dependency_job_id":"53abc8e0-c272-4aab-97c0-57ce90da2394","html_url":"https://github.com/justinmahar/simple-form-submit","commit_stats":{"total_commits":85,"total_committers":3,"mean_commits":"28.333333333333332","dds":0.05882352941176472,"last_synced_commit":"8fe5c8803890178e658257b402f2e7d00b73312b"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justinmahar%2Fsimple-form-submit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justinmahar%2Fsimple-form-submit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justinmahar%2Fsimple-form-submit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justinmahar%2Fsimple-form-submit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/justinmahar","download_url":"https://codeload.github.com/justinmahar/simple-form-submit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247704515,"owners_count":20982292,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["form","forms","submit"],"created_at":"2024-10-10T00:57:56.983Z","updated_at":"2026-02-23T21:45:42.063Z","avatar_url":"https://github.com/justinmahar.png","language":"TypeScript","funding_links":["https://github.com/sponsors/justinmahar","https://www.paypal.com/paypalme/thejustinmahar/5","https://paypal.me/thejustinmahar/5","https://paypal.me/thejustinmahar/15","https://paypal.me/thejustinmahar/25"],"categories":[],"sub_categories":[],"readme":"\u003ch2 align=\"center\"\u003e\n  ✅ Simple Form Submit\n\u003c/h2\u003e\n\u003ch3 align=\"center\"\u003e\n  Submit your form data with a simple JavaScript call.\n\u003c/h3\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://badge.fury.io/js/simple-form-submit\" target=\"_blank\" rel=\"noopener noreferrer\"\u003e\u003cimg src=\"https://badge.fury.io/js/simple-form-submit.svg\" alt=\"npm Version\" /\u003e\u003c/a\u003e\u0026nbsp;\n  \u003ca href=\"https://github.com/justinmahar/simple-form-submit/\" target=\"_blank\" rel=\"noopener noreferrer\"\u003e\u003cimg src=\"https://img.shields.io/badge/GitHub-Source-success\" alt=\"View project on GitHub\" /\u003e\u003c/a\u003e\u0026nbsp;\n  \u003ca href=\"https://github.com/justinmahar/simple-form-submit/actions?query=workflow%3ADeploy\" target=\"_blank\" rel=\"noopener noreferrer\"\u003e\u003cimg src=\"https://github.com/justinmahar/simple-form-submit/workflows/Deploy/badge.svg\" alt=\"Deploy Status\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\u003c!-- [lock:donate-badges] 🚫--------------------------------------- --\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://paypal.me/thejustinmahar/5\"\u003e\u003cimg src=\"https://img.shields.io/static/v1?label=Buy%20me%20a%20coffee\u0026message=%E2%9D%A4\u0026logo=KoFi\u0026color=%23fe8e86\" alt=\"Buy me a coffee\" /\u003e\u003c/a\u003e\u0026nbsp;\u003ca href=\"https://github.com/sponsors/justinmahar\" target=\"_blank\" rel=\"noopener noreferrer\"\u003e\u003cimg src=\"https://img.shields.io/static/v1?label=Sponsor\u0026message=%E2%9D%A4\u0026logo=GitHub\u0026color=%23fe8e86\" alt=\"Sponsor\"/\u003e\u003c/a\u003e\n\u003c/p\u003e\n\u003c!-- [/lock:donate-badges] ---------------------------------------🚫 --\u003e\n\n## Documentation\n\nRead the **[official documentation](https://justinmahar.github.io/simple-form-submit/)**.\n\n## Overview\n\nSubmits both `\u003cform/\u003e` element and [FormData](https://developer.mozilla.org/en-US/docs/Web/API/FormData) using the [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) with a single JS call. Submitting forms couldn't be easier!\n\nUses the [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch). Support for additional [Fetch API options](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch#Parameters), such as form method (`POST`, `GET`), headers, CORS modes, etc. Defaults to `POST`.\n\nReturns a [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) for handling response or error with `then()` and `catch()`.\n\n### Features include:\n\n- **📃 Submit form data quickly and easily**\n  - Just a simple call. Submitting forms couldn't be easier!\n- **✅ Supports both `\u003cform/\u003e` element and `FormData`**\n  - Submit your forms your way.\n- **👍 Uses basic `fetch` API config with optional customization**\n  - Use the default `POST` configuration, or customize the call to your heart's content.\n\n\u003c!-- [lock:donate] 🚫--------------------------------------- --\u003e\n\n## Donate \n\nIf this project helped save you time, please consider buying me a coffee, which powers my development (and life). Your support is much appreciated!\n\n\u003ca href=\"https://github.com/sponsors/justinmahar\"\u003e\u003cimg src=\"https://justinmahar.github.io/react-kindling/support/sponsor.png\" alt=\"Sponsor via GitHub\" height=\"35\" /\u003e\u003c/a\u003e\u0026nbsp; \u003ca href=\"https://paypal.me/thejustinmahar/5\"\u003e\u003cimg src=\"https://justinmahar.github.io/react-kindling/support/coffee-1.png\" alt=\"Buy me a coffee\" height=\"35\" /\u003e\u003c/a\u003e\u0026nbsp; \u003ca href=\"https://paypal.me/thejustinmahar/15\"\u003e\u003cimg src=\"https://justinmahar.github.io/react-kindling/support/coffee-3.png\" alt=\"Buy me 3 coffees\" height=\"35\" /\u003e\u003c/a\u003e\u0026nbsp; \u003ca href=\"https://paypal.me/thejustinmahar/25\"\u003e\u003cimg src=\"https://justinmahar.github.io/react-kindling/support/coffee-5.png\" alt=\"Buy me 5 coffees\" height=\"35\" /\u003e\u003c/a\u003e\n\n\u003c!-- [/lock:donate] ---------------------------------------🚫 --\u003e\n\n## Table of Contents \n\n- [Documentation](#documentation)\n- [Overview](#overview)\n  - [Features include:](#features-include)\n- [Donate](#donate)\n- [Table of Contents](#table-of-contents)\n- [Installation](#installation)\n- [Quick Start](#quick-start)\n  - [Example](#example)\n    - [Submitting using a `\u003cform/\u003e` element](#submitting-using-a-form-element)\n    - [Submitting using a `FormData` object](#submitting-using-a-formdata-object)\n- [Fetch Options](#fetch-options)\n- [TypeScript](#typescript)\n- [Icon Attribution](#icon-attribution)\n- [Contributing](#contributing)\n- [⭐ Found It Helpful? Star It!](#-found-it-helpful-star-it)\n- [License](#license)\n\n## Installation\n\n```\nnpm i simple-form-submit\n```\n\n## Quick Start\n\nYou can either:\n\n- Submit a `\u003cform/\u003e` element using `SimpleFormSubmit.submitForm(actionUrl, form)`\n- Submit `FormData` ([see docs](https://developer.mozilla.org/en-US/docs/Web/API/FormData)) using `SimpleFormSubmit.submitFormData(actionUrl, formData)`. This is useful if you want to build form data manually or transform the form data before sending.\n\nBoth functions return a Promise so you can handle success/failure cases.\n\nThis library uses the [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) to make requests.\n\n### Example\n\nWe want to use JavaScript to send data for this simple form when it's submitted:\n\n![Example Form](https://justinmahar.github.io/simple-form-submit/example-form.png)\n\n```html\n\u003cform id=\"example-form\" onSubmit=\"handleSubmit(e)\"\u003e\n  \u003cdiv\u003eEmail: \u003cinput name=\"email\" /\u003e\u003c/div\u003e\n  \u003cdiv\u003eMessage: \u003cinput name=\"message\" /\u003e\u003c/div\u003e\n  \u003cbutton\u003eSend\u003c/button\u003e\n\u003c/form\u003e\n```\n\n#### Submitting using a `\u003cform/\u003e` element\n\nWe can submit the `\u003cform/\u003e` element itself to any URL, like so:\n\n```js\nimport SimpleFormSubmit from \"simple-form-submit\";\n\nconst handleSubmit = (e) =\u003e {\n  e.preventDefault();\n\n  const formActionUrl = \"https://www.example.com/form\";\n  const form = document.getElementById(\"example-form\");\n\n  SimpleFormSubmit.submitForm(formActionUrl, form)\n    .then((response) =\u003e {\n      console.log(\"Response:\", response);\n    })\n    .catch((err) =\u003e {\n      console.log(\"Error:\", err);\n    });\n};\n```\n\n#### Submitting using a `FormData` object\n\nYou can also submit using a `FormData` object. This allows you to modify the form data before sending.\n\nYou can use `new FormData(form)` to extract the form data from an existing form. (Or, if you want, you can manually build your own `FormData` object.)\n\nFor example:\n\n```js\nimport FormData from \"form-data\";\n\nconst formActionUrl = \"https://www.example.com/form\";\nconst formData = new FormData(document.getElementById(\"example-form\"));\n\n// Transform the data here if you'd like.\nformData.set(\"email\", formData.get(\"email\").toLowerCase());\nformData.append(\"date\", new Date().toString());\n\nSimpleFormSubmit.submitFormData(formActionUrl, formData)\n  .then((response) =\u003e {\n    console.log(\"Response:\", response);\n  })\n  .catch((err) =\u003e {\n    console.log(\"Error:\", err);\n  });\n```\n\n## Fetch Options\n\nYou can specify the method (`GET` or `POST`), mode (such as `no-cors`), headers, and other [Fetch API options](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch#Parameters) if you'd like. The default method is `POST`.\n\n```js\nconst formActionUrl = \"https://www.example.com/form\";\nconst form = document.getElementById(\"example-form\");\n\n// You can specify any Fetch API options here.\nconst fetchOptions = {\n  // method: \"GET\",\n  // mode: \"no-cors\",\n  // ...\n};\n\nSimpleFormSubmit.submitForm(formActionUrl, form, fetchOptions)\n  .then((response) =\u003e {\n    console.log(\"Response:\", response);\n  })\n  .catch((err) =\u003e {\n    console.log(\"Error:\", err);\n  });\n```\n\n\u003c!-- [lock:typescript] 🚫--------------------------------------- --\u003e\n\n## TypeScript\n\nType definitions have been included for [TypeScript](https://www.typescriptlang.org/) support.\n\n\u003c!-- [/lock:typescript] ---------------------------------------🚫 --\u003e\n\n\u003c!-- [lock:icon] 🚫--------------------------------------- --\u003e\n\n## Icon Attribution\n\nFavicon by [Twemoji](https://github.com/twitter/twemoji).\n\n\u003c!-- [/lock:icon] ---------------------------------------🚫 --\u003e\n\n\u003c!-- [lock:contributing] 🚫--------------------------------------- --\u003e\n\n## Contributing\n\nOpen source software is awesome and so are you. 😎\n\nFeel free to submit a pull request for bugs or additions, and make sure to update tests as appropriate. If you find a mistake in the docs, send a PR! Even the smallest changes help.\n\nFor major changes, open an issue first to discuss what you'd like to change.\n\n\u003c!-- [/lock:contributing] --------------------------------------🚫 --\u003e\n\n## ⭐ Found It Helpful? [Star It!](https://github.com/justinmahar/simple-form-submit/stargazers)\n\nIf you found this project helpful, let the community know by giving it a [star](https://github.com/justinmahar/simple-form-submit/stargazers): [👉⭐](https://github.com/justinmahar/simple-form-submit/stargazers)\n\n\u003c!-- [lock:support] 🚫--------------------------------------- --\u003e\nWant to support the project? Feel free to grab me a coffee, which is my main source of fuel for development:\n\n\u003ca href=\"https://paypal.me/thejustinmahar/5\"\u003e\u003cimg src=\"https://justinmahar.github.io/react-kindling/support/coffee-1.png\" alt=\"Buy me a coffee\" height=\"35\" /\u003e\u003c/a\u003e\u0026nbsp; \u003ca href=\"https://paypal.me/thejustinmahar/15\"\u003e\u003cimg src=\"https://justinmahar.github.io/react-kindling/support/coffee-3.png\" alt=\"Buy me 3 coffees\" height=\"35\" /\u003e\u003c/a\u003e\u0026nbsp; \u003ca href=\"https://paypal.me/thejustinmahar/25\"\u003e\u003cimg src=\"https://justinmahar.github.io/react-kindling/support/coffee-5.png\" alt=\"Buy me 5 coffees\" height=\"35\" /\u003e\u003c/a\u003e\n\n\u003c!-- [/lock:support] ---------------------------------------🚫 --\u003e\n\n## License\n\nSee [LICENSE.md](https://justinmahar.github.io/simple-form-submit/?path=/docs/license--docs).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjustinmahar%2Fsimple-form-submit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjustinmahar%2Fsimple-form-submit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjustinmahar%2Fsimple-form-submit/lists"}