Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

Commit 071e90b

Browse files
committed
Added deleteMethod option.
This option is used in conjunction with deleteSCript. Use deleteMethod when you want to use any HTTP Method you want (e.g. DELETE) to delete the image.
1 parent 2468cb0 commit 071e90b

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/js/images.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
addonName = 'Images', // first char is uppercase
1010
defaults = {
1111
label: '<span class="fa fa-camera"></span>',
12+
deleteMethod: 'POST',
1213
deleteScript: 'delete.php',
1314
preview: true,
1415
captions: true,
@@ -521,7 +522,14 @@
521522

522523
Images.prototype.deleteFile = function (file) {
523524
if (this.options.deleteScript) {
524-
$.post(this.options.deleteScript, { file: file });
525+
// If deleteMethod is somehow undefined, defaults to POST
526+
var method = this.options.deleteMethod || 'POST';
527+
528+
$.ajax({
529+
url: this.options.deleteScript,
530+
type: method,
531+
data: { file: file }
532+
});
525533
}
526534
};
527535

0 commit comments

Comments
 (0)