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