I have a jstree building nodes from a return data call. However sometimes it returns null and I need to handle this by showing some error message on the UI. I tried to add check on the returned data but it keeps showing loading icon and not display my intended div with the message. My code:
“`
$(‘#jstree-test’).jstree({
core: {
data: function (node, cb) {
$.getJSON()
.done(function (data, status, xhr) {
if(data == null)
{
$(‘#Error’).show();
}
else
{
globfunc.redirect(xhr);
cb.call(this, data);
}
})
.fail(function (data, status, xhr) {
if (xhr.hasOwnProperty(“status”)) {
globfunc.redirect(xhr);
} else {
globfunc.showModal(xhr);
}
});
}
}
})
Is there anything I need to do to achieve this?