Skip to content

Commit

Permalink
Merge pull request #59 from skillmatic-co/patch-1
Browse files Browse the repository at this point in the history
[#42] Add base URL to AJAX URL call
  • Loading branch information
itmammoth authored Mar 27, 2023
2 parents f64ad3d + feec530 commit de941f5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions vendor/assets/javascripts/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
$.fn.railsSortable = function(options) {
options = options || {};
var settings = $.extend({}, options);

settings.baseUrl = settings.baseUrl || '';

settings.update = function(event, ui) {
if (typeof options.update === 'function') {
Expand All @@ -11,7 +13,7 @@

$.ajax({
type: 'POST',
url: '/sortable/reorder',
url: settings.baseUrl + '/sortable/reorder',
dataType: 'json',
contentType: 'application/json',
data: JSON.stringify({
Expand All @@ -22,4 +24,4 @@

this.sortable(settings);
};
})(jQuery);
})(jQuery);

0 comments on commit de941f5

Please sign in to comment.