In this context, `this` already points to the element, so there is no need to search it again.
23 lines
488 B
JavaScript
23 lines
488 B
JavaScript
(function() {
|
|
"use strict";
|
|
App.Sortable = {
|
|
initialize: function() {
|
|
$(".sortable").sortable({
|
|
update: function() {
|
|
var new_order;
|
|
new_order = $(this).sortable("toArray", {
|
|
attribute: "data-answer-id"
|
|
});
|
|
$.ajax({
|
|
url: $(this).data("js-url"),
|
|
data: {
|
|
ordered_list: new_order
|
|
},
|
|
type: "POST"
|
|
});
|
|
}
|
|
});
|
|
}
|
|
};
|
|
}).call(this);
|