Checkbox is checked, but :checked doesn't work
<p>I have a few checkboxes. I'm setting and resetting the default values of the checkboxes with the .prop() function, based on a JSON response (loading the data via ajax-requests). The problem is, that they apparently don't change this behaviour, if I change them manually. I can't pass the value of the checkboxes via $('#checkbox :checked').val(), a console log says 'undefined'. Is this because of the .prop() function? How can I get the value of the checked checkboxes?</p>

<p>If you need more information, i'll gladly provide them.
Here some code:</p>

<pre><code>if (json.event.public_visible == 1) {
  $('#event_public_visible').prop('checked', true);
} else {
  $('#event_public_visible').prop('checked', false);
}

if (json.event.package_event == 1) {
  $('#event_package_only').prop('checked', true);
} else {
  $('#event_package_only').prop('checked', false);
}
</code></pre>

<p>Update: more code</p>

<pre><code>var editEvent = function () {
  if ($('#event_public_visible').is(':checked')) {
    console.log('test');
  }
  formData = {
    // ... other fields
    event_package_only: $('#event_package_only :checked').val(),
    event_public_visible: $('#event_public_visible :checked').val(),
    // ... more fields
  };

  $.ajax({
    url: base_url + "admin/events/editAsync",
    type: "POST",
    data: formData,
    dataType: "json",
    success: function (json) {
      // success handling
    }
  });
};
</code></pre>
