Permalink
Browse files

Fixed queryString for delete requests

  • Loading branch information...
1 parent 21bf5df commit a74a519aed2a0f48f480cde3ce16a46a061a84c1 @seratch seratch committed Mar 7, 2014
Showing with 7 additions and 1 deletion.
  1. +7 −1 framework/src/main/resources/WEB-INF/assets/js/skinny-framework.js
View
8 framework/src/main/resources/WEB-INF/assets/js/skinny-framework.js
@@ -11,13 +11,19 @@
parts.pop();
return parts.join("/");
}
+ function hasQuestion(url) {
+ return url.indexOf("?") != -1
+ }
+ function withCsrfToken(url, token) {
+ return hasQuestion(url) ? url + '&csrf-token=' + token : url + '?csrf-token=' + token;
+ }
$(document).delegate('a[data-method], a[data-confirm]', 'click', function(event) {
if (window.confirm($(event.target).data('confirm'))) {
var csrfToken = $('meta[name=csrf-token]').attr("content") || $(event.target).data('csrf-token');
var url = event.target.href;
var method = $(event.target).data('method');
$.ajax({
- url: url + '?csrf-token=' + csrfToken,
+ url: withCsrfToken(url, csrfToken),
method: method,
success: function(data, status, xhr) {
if (method === 'delete') location.href = toResourcesUrl(url);

0 comments on commit a74a519

Please sign in to comment.