2013-02-22 06:56:46 +01:00
|
|
|
//try to add ajax data as query string to DELETE calls.
|
2013-04-11 03:24:34 +02:00
|
|
|
"use strict";
|
2013-03-30 00:28:58 +01:00
|
|
|
(function () {
|
2013-02-16 00:38:53 +01:00
|
|
|
|
|
|
|
var original = Backbone.ajax;
|
|
|
|
|
2013-03-30 00:28:58 +01:00
|
|
|
Backbone.ajax = function () {
|
2013-02-16 00:38:53 +01:00
|
|
|
|
|
|
|
var xhr = arguments[0];
|
|
|
|
|
|
|
|
//check if ajax call was made with data option
|
2013-03-30 00:28:58 +01:00
|
|
|
if (xhr && xhr.data && xhr.type == 'DELETE') {
|
|
|
|
if (xhr.url.indexOf('?') === -1) {
|
2013-02-16 00:38:53 +01:00
|
|
|
xhr.url = xhr.url + '?' + $.param(xhr.data);
|
|
|
|
}
|
2013-03-30 00:28:58 +01:00
|
|
|
else {
|
2013-02-16 00:38:53 +01:00
|
|
|
xhr.url = xhr.url + '&' + $.param(xhr.data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-30 00:28:58 +01:00
|
|
|
if (original) {
|
|
|
|
original.apply(this, arguments);
|
2013-02-16 00:38:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
};
|
2013-03-30 00:28:58 +01:00
|
|
|
}());
|