Files
codeocean/app/assets/javascripts/error_templates.js
Sebastian Serth 16a5345a71 Migrate jQuery function use for ajax in case of success or failure
Deprecation Notice:

The jqXHR.success(), jqXHR.error(), and jqXHR.complete() callbacks will be deprecated in jQuery 1.8. To prepare your code for their eventual removal, use jqXHR.done(), jqXHR.fail(), and jqXHR.always() instead.
2018-11-26 12:23:30 +01:00

18 lines
653 B
JavaScript

$(document).on('turbolinks:load', function() {
if ($.isController('error_templates')) {
$('#add-attribute').find('button').on('click', function () {
$.ajax(location + '/attribute.json', {
method: 'POST',
data: {
_method: 'PUT',
dataType: 'json',
error_template_attribute_id: $('#add-attribute').find('select').val()
}
}).done(function () {
location.reload();
}).fail(function (error) {
$.flash.danger({text: error.statusText});
});
});
}
});