๐Ÿ“ฆ lovelydinosaur / ajax-form

โ˜… 38 stars โ‘‚ 4 forks ๐Ÿ‘ 38 watching
๐Ÿ“ฅ Clone https://github.com/lovelydinosaur/ajax-form.git
HTTPS git clone https://github.com/lovelydinosaur/ajax-form.git
SSH git clone git@github.com:lovelydinosaur/ajax-form.git
CLI gh repo clone lovelydinosaur/ajax-form
Tom Christie Tom Christie Add support for button controls 4779009 10 years ago ๐Ÿ“ History
๐Ÿ“‚ master View all commits โ†’
๐Ÿ“„ ajax-form.js
๐Ÿ“„ index.html
๐Ÿ“„ README.md
๐Ÿ“„ server.py
๐Ÿ“„ README.md

AJAX Form

  • Adds support for PUT, PATCH, DELETE and OPTIONS methods in HTML forms.
  • Adds support for submitting JSON and other content types in HTML forms.
See index.html for example usage.

Requirements

jQuery 1.9+

Restrictions

  • Multipart (file upload) is only supported in browsers that support the FormData API.
  • Browsers that do not support the history API will result in a subsequent GET request.
  • Cross-domain requests will result in a subsequent GET request.
  • Non-HTML responses will result in a subsequent GET request.

Usage - PUT, PATCH, DELETE, OPTIONS methods

Use data-method="***".

Or using button controls.

Usage - Content type overriding

Use data-override="content" and data-override="content-type".

Using an input control:

Using a select control: