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.
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 :
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 technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.