JS - read data from table to array

var dataArray = new Array;
var i = 0;
var strAux = {};
$("table[summary='InfoSuporte']").find("td").each(function() {
if(($(this).children('div').length) == 0){
i++;

//console.log($(this).html());
if(i==1) { strAux["columnA"] = $(this).html(); }
if(i==2) { strAux["columnB"] = $(this).html(); }
if(i==3) { strAux["columnC"] = $(this).html(); }
if(i==4) { strAux["columnD"] = $(this).html(); }
if(i==5) { strAux["columnE"] = $(this).html(); }

if(i%5 == 0){
dataArray.push(strAux);
strAux = {};
i=0;
}
}
});

Comments

Popular posts from this blog

Download file from input type file javascript

POST an array of objects with $.ajax to C# WebMethod

SQL Views - Variables