{"id":13826038,"url":"https://github.com/github/remote-form","last_synced_at":"2025-04-05T03:04:35.777Z","repository":{"id":37502606,"uuid":"181677179","full_name":"github/remote-form","owner":"github","description":"Submit forms via AJAX with ease","archived":false,"fork":false,"pushed_at":"2025-03-17T16:52:27.000Z","size":762,"stargazers_count":56,"open_issues_count":0,"forks_count":19,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-29T02:06:07.467Z","etag":null,"topics":["ajax","decorator","form","microlibrary"],"latest_commit_sha":null,"homepage":"","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/github.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-04-16T11:36:11.000Z","updated_at":"2025-03-27T19:51:31.000Z","dependencies_parsed_at":"2024-01-18T04:07:16.848Z","dependency_job_id":"39ec2291-0b60-402c-bf17-ea6b8f643c18","html_url":"https://github.com/github/remote-form","commit_stats":{"total_commits":94,"total_committers":9,"mean_commits":"10.444444444444445","dds":"0.25531914893617025","last_synced_commit":"bf6fa9c96b5a025399c92da5ca694500854cd248"},"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/github%2Fremote-form","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/github%2Fremote-form/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/github%2Fremote-form/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/github%2Fremote-form/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/github","download_url":"https://codeload.github.com/github/remote-form/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247280262,"owners_count":20912967,"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":["ajax","decorator","form","microlibrary"],"created_at":"2024-08-04T09:01:31.142Z","updated_at":"2025-04-05T03:04:35.758Z","avatar_url":"https://github.com/github.png","language":"TypeScript","funding_links":[],"categories":["JavaScript","TypeScript"],"sub_categories":[],"readme":"# remote-form\n\nA function that will enable submitting forms over AJAX.\n\nThe function will make a request based on the form using `window.fetch` with the payload encoded as URL parameters if the form method is a `GET` and `FormData` for all the other methods.\n\nThe request object is available in the callback function, allowing the headers and body to be modified before the request is sent.\n\n## Installation\n\n```\n$ npm install --save @github/remote-form\n```\n\n## Usage\n\n```js\nimport {remoteForm} from '@github/remote-form'\n\n// Make all forms that have the `data-remote` attribute a remote form.\nremoteForm('form[data-remote]', async function(form, wants, request) {\n  // Before we start the request\n  form.classList.remove('has-error')\n  form.classList.add('is-loading')\n\n  let response\n  try {\n    response = await wants.html()\n  } catch (error) {\n    // If the request errored, we'll set the error state and return.\n    form.classList.remove('is-loading')\n    form.classList.add('has-error')\n    return\n  }\n\n  // If the request succeeded we can do something with the results.\n  form.classList.remove('is-loading')\n  form.querySelector('.results').innerHTML = response.html\n})\n```\n\n```html\n\u003cform action=\"/signup\" method=\"post\" data-remote\u003e\n  \u003clabel for=\"username\"\u003eUsername\u003c/label\u003e\n  \u003cinput id=\"username\" type=\"text\"\u003e\n\n  \u003clabel for=\"password\"\u003eUsername\u003c/label\u003e\n  \u003cinput id=\"password\" type=\"password\"\u003e\n\n  \u003cbutton type=\"submit\"\u003eLog in\u003c/button\u003e\n  \u003cdiv class=\"results\"\u003e\u003c/div\u003e\n\u003c/form\u003e\n```\n\n## Browser support\n\nBrowsers without native [custom element support][support] require a [polyfill][].\n\n- Chrome\n- Firefox\n- Safari\n- Microsoft Edge\n\n[support]: https://caniuse.com/#feat=custom-elementsv1\n[polyfill]: https://github.com/webcomponents/custom-elements\n\n## Development\n\n```\nnpm install\nnpm test\n```\n\n## License\n\nDistributed under the MIT license. See LICENSE for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgithub%2Fremote-form","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgithub%2Fremote-form","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgithub%2Fremote-form/lists"}