Reason for having it an array of objects: makes sorting faster if you use this to generate a sortable table or datagrid.
loadXML2array: function() {
return this.each(function() {
var data = $.ajax({
type: "GET",
url: "echo.php?xml=datatable1",
async: false,
success: function(xml) {
objectArray = new Array();
$(xml).find('row').each(function(i){
rowObj = new Object();
rowObj.col1 = $(this).children('col_1').text();
rowObj.col2 = $(this).children('col_2').text();
rowObj.col3 = $(this).children('col_3').text();
objectArray.push(rowObj);
});
}
})
});
}
No comments:
Post a Comment