From f605f8818520c4fc6ed2269b625fe4d1d930749f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Mon, 7 Dec 2015 08:52:13 +0100 Subject: [PATCH] misc: fix ajax-loading of empty cell (#9223) This is a workaround for jQuery .replaceWith() not working with empty strings. --- combo/public/static/js/combo.public.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/combo/public/static/js/combo.public.js b/combo/public/static/js/combo.public.js index 0048052f..c6e43942 100644 --- a/combo/public/static/js/combo.public.js +++ b/combo/public/static/js/combo.public.js @@ -4,7 +4,13 @@ function combo_load_cell(elem, url) { async: true, dataType: 'html', crossDomain: true, - success: function(data) { $(elem).replaceWith(data); }, + success: function(data) { + if (data == '') { + $(elem).remove(); + } else { + $(elem).replaceWith(data); + } + }, error: function(error) { $(elem).addClass('error-loading'); window.console && console.log(':(', error);