Skip to content

Instantly share code, notes, and snippets.

@darrinholst
Created March 13, 2011 16:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save darrinholst/868239 to your computer and use it in GitHub Desktop.
Save darrinholst/868239 to your computer and use it in GitHub Desktop.
$("#some_checkbox").click(function() {
var checkbox = $(this)
checkbox.attr("disabled", true)
$.ajax($("form").attr("action"), {
type: "POST",
data: $("form").serialize(),
success: function() {
alert("User updated")
},
error: function() {
alert("Oops, something didn't work!")
},
complete: function() {
checkbox.attr("disabled", false)
}
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment