
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.
18 lines
653 B
JavaScript
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});
|
|
});
|
|
});
|
|
}
|
|
}); |