misc: fix ajax-loading of empty cell (#9223)

This is a workaround for jQuery .replaceWith() not working with empty strings.
This commit is contained in:
Frédéric Péters 2015-12-07 08:52:13 +01:00
parent ffff0b7462
commit f605f88185
1 changed files with 7 additions and 1 deletions

View File

@ -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);