Whenever a row is selected by the user from a table, I take the values of that row and store them in an array.
Code:
var outer_array = []
//loop through checked checkboxes
$("tbody input[type=checkbox]:checked").each(function(index, item) {
var inner_array = []
var selector = $(this).closest("tr") //get closest tr
//loop through trs td not first one
selector.find("td:not(:first)").each(function() {
inner_array.push($.isNumeric($(this).text().trim()) ? Number($(this).text().trim()) : $(this).text().trim())
//push in inner array
})
outer_array.push(inner_array) //push in outer array
})
There's an issue where the inner_array contains unwanted characters such as the byte: "b'\x00'"
These problematic characters are causing issues on the back-end since Python interprets backslashes as special characters.
Is there a way to eliminate these unwanted byte characters?
For instance, instead of pushing that byte, I would like to push an empty string (pseudo):
if (byte_code){
innter_array.push('')
} else {
inner_array.push($.isNumeric($(this).text().trim()) ? Number($(this).text().trim()) : $(this).text().trim());
}