when executing the following code firebug tells me: msj[0] is undefined what is the problem?
What I want to do is that every time it receives a response after every run, catch it in the array after calling msg to generate a single alert to show me all the answers together...
I don't understand why me show undefined if the array has data, in this case has three data..
var msj = [];
for (var a = document.querySelectorAll('table.inventory tbody tr'), i = 0; a[i]; ++i) {
// get inventory row cells
cells = a[i].querySelectorAll('span:last-child');
// buscar la selecion del concepto
var opciones = cells[0].querySelectorAll('option:checked');
var value_concept = opciones[0].value;
// set price as cell[2] * cell[3]
var Uno = value_concept;
var Dos = cells[1].innerHTML ;
var Tres = parseFloatHTML(cells[2]);
var Cuatro = parseFloatHTML(cells[3]);
var Cinco = parseFloatHTML(cells[4]);
var id_fac = id_fac_select;
var valor_fac = costo_fac_select.split(".");
var valor_fact = valor_fac[0];
var valor_recibo = Cinco;
$.ajax({
url:"js.php",
cache:false,
type:"POST",
data:{concepto:Uno,descripcion:Dos,valor_total:Tres,valor_pagado:Cuatro,valor_f:valor_fact,saldo_pendiente:valor_recibo,numero_factura:id_fac,id_estudiante:id_student},
success:function(result)
{
msj.push(result);
}
});
}
console.log(msj);
alert(msj[0]);