Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
This plugin gives you an option to disable remote links during the AJAX request
Ruby
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
vendor/assets/javascripts
.gitignore
Gemfile
README.md
Rakefile
TODO.md
jquery-disablewith.gemspec

README.md

jquery-disablewith

jQuery plugin for rails applications, which provides an simple method to disable AJAX button and replace its text while the request is running.

Example

somewhere in your views:

= link_to "Send request", url, remote: true

then in application.js you can write something like that:

$("a").disableWith();

It will replace "Send request" words with "Processing..." before the request start, and turn it back on complete. It will also disable the click event on the element until the AJAX request complete.

You can change the text:

$("a").disableWith({ text: "Loading..." });

Requirements

  • jquery-rails

Installation

Add to the Gemfile

gem jquery-disablewith

Then run

bundle install

Usage

Add

//=require jquery.disablewith

into the application.js

Something went wrong with that request. Please try again.