manage-groups.js 356 Bytes
$(function() {
  $('#user-groups input[type=checkbox]').change(function() {
    var $t = $(this),
      user = this.id.split('-')[2],
      group = this.id.split('-')[1];
    $.ajaxJSON({
      method: 'post',
      url: ajax_set_group,
      data: {
        user_id: user,
        group_id: group,
        set: $t.is(':checked')
      }
    });
  });
});