Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bfontaine/togglable
jQuery plugin to toggle boolean values with AJAX.
https://github.com/bfontaine/togglable
ajax jquery
Last synced: 22 days ago
JSON representation
jQuery plugin to toggle boolean values with AJAX.
- Host: GitHub
- URL: https://github.com/bfontaine/togglable
- Owner: bfontaine
- Created: 2013-03-05T22:24:50.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2013-03-06T15:14:14.000Z (almost 12 years ago)
- Last Synced: 2024-12-08T21:03:28.712Z (25 days ago)
- Topics: ajax, jquery
- Language: JavaScript
- Size: 188 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Togglable
This jQuery plugin allows you to toggle boolean values (e.g. user settings)
using AJAX calls.This is currently under developement.
## Usage
Add a `togglable` class and a `data-togglable-values` to enable Togglable on an
element, then call the `.togglable` method on its container:```
$( '#the-container' ).togglable();
```You can use multiple togglable elements in one container.
An URL must be given for each element. You can use the same URL for all, using:
```
$( '#the-container' ).togglable({ url: '/foo' });
```…Or you can set a `data-togglable-url` on each element. Possible values should
be specified in a `data-togglable-values`. They can be comma-separated, or a
valid JSON array of objects. Each object must have a `label` and a `value`
properties, e.g.:```html
```### Example
```html
Yes or no?
``````js
$( '#some-id' ).togglable({
url: '/api/1/yes-or-no/toggle'
});
```