map () станет вашим другом здесь.
var StateIDs = $(':checked').map(function() {
return this.value;
}).get().join(',');
StateID будет строкой через запятую.
Шаг за шагом - что происходит?
$(':checked')
// Returns jQuery array-like object of all checked inputs in the document
// Output: [DOMElement, DOMElement]
$(':checked').map(fn);
// Transforms each DOMElement based on the mapping function provided above
// Output: ["CA", "VA"] (still a jQuery array-like object)
$(':checked').map(fn).get();
// Retrieve the native Array object from within the jQuery object
// Output: ["CA", "VA"]
$(':checked').map(fn).get().join(',');
// .join() will concactenate each string in the array using ','
// Output: "CA,VA"