Sha256: a4be8671ac5b3de5a2265e73f8375daff0e264076b80b6968e0ac99c4236c42f

Contents?: true

Size: 457 Bytes

Versions: 5

Compression:

Stored size: 457 Bytes

Contents

$(function() {
  $('.ajax_checkbox').change(function() {
    var el = $(this);
    var checked = el.is(':checked');
    var url = el.data('path');
    var field = el.data('field');
    var data = {site_project: {}};
    
    data['site_project'][field] = checked;
    
    $.ajax({
      type: 'patch',
      dataType: 'json',
      url: url,
      data: data,
      error: function() {
        alert('Error updating the record');
      }
    });
  });
});

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rails-portfolio-0.0.5 app/assets/javascripts/portfolio/ajax_checkbox.js
rails-portfolio-0.0.4 app/assets/javascripts/portfolio/ajax_checkbox.js
rails-portfolio-0.0.3 app/assets/javascripts/portfolio/ajax_checkbox.js
rails-portfolio-0.0.2 app/assets/javascripts/portfolio/ajax_checkbox.js
rails-portfolio-0.0.1 app/assets/javascripts/portfolio/ajax_checkbox.js