[英]Problems with NaN when use jsonData and count variable
The Problem: 问题:
When I try to concat in .html(jsondatareg.recibido+i)
my explorer returns NaN
value because the Js can't concat the two "strings" values. 当我尝试在.html(jsondatareg.recibido+i)
我的资源管理器将返回NaN
值,因为Js无法合并两个“字符串”值。
My code: 我的代码:
var params = '&cedula='+cedula;
$.post('classes/recibirDatos', params, function(jsondatareg){
for(var i = 0; i < jsondatareg.contador; i++){
$('#recibido'+i).html(jsondatareg.recibido+i);
console.log(jsondatareg.recibido+i);
}
},'json');
The values: 价值:
you can access the json
property like an array
, try this : 您可以像array
一样访问json
属性,请尝试以下操作:
var params = '&cedula='+cedula;
$.post('classes/recibirDatos', params, function(jsondatareg){
for(var i = 0; i < jsondatareg.contador; i++){
$('#recibido'+i).html(jsondatareg["recibido" + i]);
console.log(jsondatareg["recibido" + i]);
}
},'json');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.