manage-groups.js 482 Bytes
/* global $dj */

$(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')
            }
        });
    });
});