From ff994558c5c2c2b9296aa8d2eb5a4beb3d75ce41 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 0048052..c6e4394 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); -- 2.6.2