2013-02-22 05:56:46 +00:00
|
|
|
//try to add ajax data as query string to DELETE calls.
|
2013-06-22 06:24:24 +00:00
|
|
|
'use strict';
|
2013-06-21 05:35:56 +00:00
|
|
|
define(function () {
|
2013-02-15 23:38:53 +00:00
|
|
|
|
2013-06-21 05:35:56 +00:00
|
|
|
return function () {
|
2013-02-15 23:38:53 +00:00
|
|
|
|
2013-06-21 05:35:56 +00:00
|
|
|
var original = this.ajax;
|
|
|
|
this.ajax = function () {
|
2013-02-15 23:38:53 +00:00
|
|
|
|
2013-06-21 05:35:56 +00:00
|
|
|
var xhr = arguments[0];
|
2013-02-15 23:38:53 +00:00
|
|
|
|
2013-06-21 05:35:56 +00:00
|
|
|
//check if ajax call was made with data option
|
|
|
|
if (xhr && xhr.data && xhr.type === 'DELETE') {
|
|
|
|
if (xhr.url.indexOf('?') === -1) {
|
|
|
|
xhr.url = xhr.url + '?' + $.param(xhr.data);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
xhr.url = xhr.url + '&' + $.param(xhr.data);
|
|
|
|
}
|
2013-07-11 22:38:15 +00:00
|
|
|
|
|
|
|
delete xhr.data;
|
2013-02-15 23:38:53 +00:00
|
|
|
}
|
|
|
|
|
2013-06-21 05:35:56 +00:00
|
|
|
return original.apply(this, arguments);
|
|
|
|
};
|
2013-02-15 23:38:53 +00:00
|
|
|
};
|
2013-06-21 05:35:56 +00:00
|
|
|
|
2013-06-14 23:18:37 +00:00
|
|
|
});
|