Add clicked checkboxes to serialized jQuery string

Quick way to add vars at the end of a serialized jQuery form. The below content uses checkboxes but you could use any variable.
 
$("#btnAddNew").button().click(function() {
var programList = $('.programs:checked').map(function() {return this.value;}).get().join(',') // capture checkboxes
var disciplineList = $('.discipline:checked').map(function() {return this.value;}).get().join(',') // capture checkboxes
var theData = $("#addSchool").serialize() + '&programList=' + programList + '&dL=' + disciplineList;
 
}

 

Not much to it the vars are checkboxes the following line captures if they are checked.

var someVar = $('.yourClass:checked').map(function() {return this.value;}).get().join(',') // capture checkboxes

Once you have the var captured you can concatenate it like you would any other string URL ect.

var theData = $("#someID").serialize() + '&someValue=' + someVar;