I have a jquery function that converts an table row into an array.
$("#table1 tr").click(function () {
// alert($(this).text());
// alert($(this).children("td").html());
// app.greet();
var $row = $(this).closest("tr"), // Finds the closest row <tr>
$tds = $row.find("td"); // Finds all children <td> elements
$.each($tds, function () { // Visits every single <td> element
// console.log($(this).text());
list.push($tds);
// Prints out the text within the <td>
});
console.log(list.length)
});
I want to then convert the jquery array into my vue array which is structured this way.
data() {
return {
tableRow: [
{
"name": "name1",
"numSongs": "joker",
"Year": "year"
}
]
}
},
This is the way i was trying to do it but it im getting a unexpected end of json input error.
this.tableRow = JSON.parse(list);
Does anyone have any suggestions.
console.log(list)