I am getting output in console like {}, Now I am checking it in if condition, it does not work
$.ajax({
...
success: function(data){
if (data.length) {
if(data.length === 0){
$('.library_info_tbl tbody').prepend('<tr><td class="text-center centeralign" colspan="8">No Data Available!</td></tr>');
}
else{
}
}
});
If data contains {}, it does not check if condition i.e if(data.length === 0) does not work in the code.
dataappears to be a plain object, not an array?[]have a length property, objects{}don't (unless you added one yourself.)