【发布时间】:2017-06-10 22:19:45
【问题描述】:
我已经尝试过在网站上发布的几个答案,例如:
How to check if JSON return is empty with jquery
没有人为我工作。
xhr.onload = function(){
detalles = xhr.responseText;
console.log("log : "+detalles);
....
}
控制台输出:
log : [0]
Firefox 调试器网络选项卡显示 JSON 0:0
我们将不胜感激。
编辑 - 添加更多代码来扩展上下文
xhr.onload = function(){
detalles = xhr.responseText;
console.log(detalles);
if((!$.trim(detalles))||($.isEmptyObject(detalles))||(!detalles[0])){
console.log("ok");
$("#graficohist").html("No info available");
triggerLoader();
}
【问题讨论】:
-
@Salman 这里是控制台输出:[0]
-
@Salman xhr 是我使用的方法,而不是 jquery AJAX (XML HTTP REQUEST)。
标签: javascript json