<commit_before>$(function() {
  $( ".check_function" ).on( "click", ".checked_on", function( event ) {
    $(this).removeClass("checked_on").addClass("checked_off");
      var course_id = $(this).data("id");
      console.log(course_id);
    $.ajax({
      url: '/courses/'+course_id+'/check',
      type: 'post'
    }).done(function( response ) {
    console.log(response);
  });

  });
   $( ".check_function" ).on( "click", ".checked_off", function( event ) {
    $(this).removeClass("checked_off").addClass("checked_on");

  });


});
<commit_msg>Fixed ajax call<commit_after>$(function() {
  $( ".check_function" ).on( "click", ".checked_on", function( event ) {
    $(this).removeClass("checked_on").addClass("checked_off");
      var course_id = $(this).data("id");
      console.log(course_id);
    toggle_check(course_id).done(function( response ) {
    console.log(response);
  });

  });
   $( ".check_function" ).on( "click", ".checked_off", function( event ) {
          var course_id = $(this).data("id");

    $(this).removeClass("checked_off").addClass("checked_on");
    toggle_check(course_id);
  });


});

var toggle_check = function(id){
  var course_id = id;
  return $.ajax({
      url: '/courses/'+course_id+'/check',
      type: 'post'
    })

}
{'fraction_non_alphanumeric': 0.2173228346456693, 'fraction_numerical': 0.0, 'mean_word_length': 3.6218181818181816, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7542516', 'n_tokens_mistral': 421, 'n_tokens_neox': 417, 'n_words': 67}